2010-12-03 40 views
1

alt text我想用css [image]設計這兩個盒子?

我想創建使用CSS這種效果,你可以看到大箱子的標題和博客文章,並與它的日期和它的評論的數量小盒子。它一直困惑着我,一個例子將是非常感謝傢伙:))

+0

你爲什麼不只是安裝Firefox和看一下例子的CSS?或者至少,給我們提供一個鏈接,以便我們可以做到這一點。 – joni 2010-12-03 10:16:22

+0

這個例子就在你的面前,轉到頁面點擊View> Source,你將擁有所有你需要的東西。 – Kyle 2010-12-03 10:16:23

+0

我可以;看到:(:( – 2010-12-03 10:16:42

回答

1

在HTML中,只需創建兩個單獨的div,一個用於細節,另一個用於內容。

<div class="post"> 
    <div class="post_details"> 
     <div class="post_date"> 
      <div class="post_day">26</div> 
      <div class="post_month">NOV/10</div> 
     </div> 
     <div class="post_comments">2</div> 
    </div> 
    <div class="post_text"> 
     <div class="post_title">PASSION SUCCESS AND MONEY</div> 
     <div class="post_title">A lot of people...</div> 
    </div> 
</div> 

使用CSS,您可以將細節框左側或絕對位置浮動到一側。

.post   { clear:both; width:600px; } 
.post_details { float:left; width:53px; height:93px; background:#fff; } 
.post_date { width:48px; background:#ddd; } 
.post_month { width:48px; background:#666; } 
.post_text { float:left; width:545px; background:#fff; } 
0

主要技巧將在使用CSS3 border-radius屬性。這使箱子變圓。你必須使用供應商前綴來獲得當前的瀏覽器這方面的工作:

-webkit-border-radius: 10px; 
-moz-border-radius: 10px; 
-khtml-border-radius: 10px; 
border-radius: 10px;