2013-02-15 115 views
0

我有3 div s。如果其他div高度調整,我如何使他們平等。我希望我所有的div都能調整它的高度,即使它們的內容較少。就像在圖像中一樣,即使沒有數據的div也必須與其他圖像相同,並在底部設置讀取更多。div集高度相等

HTML:

<div class="column-wrapper"> 
    <div class="column-small border border-top"> 
     <h3>Features</h3> 

     <ul> 
     <li>Code blocking</li> 
     <li>Code Wrapping</li> 
     <li>Code Killing</li> 
     <li>Code Sleeping</li> 
     </ul> 

     <span><a href="#">Read more</a></span> 
    </div> 

    <div class="column-small border border-top"> 
     <h3>Modules</h3> 

     <ul> 
     <li>Barking Around The house</li> 
     <li>Loving the Cats</li> 
     <li>Floating The points</li> 
     <li>Coding The Sleepers</li> 
     </ul> 

     <span><a href="#">Read more</a></span> 
    </div> 

    <div class="column-small border border-top"> 
     <h3>Idont knows</h3> 
     <span><a href="#">Read more</a></span> 
    </div> 
</div> 

CSS:

.column-wrapper { 
    padding-top: 20px; 
    text-align: center; 
    vertical-align: middle; 
    width: 100%; 
} 

.column-wrapper div { 
    display: inline-table; 
    margin: 2px; 
} 

.column-small { 
    padding: 10px; 
    width: 30%; 
    min-width: 250px; 
    height: auto; 
} 

.column-small span { 
    float: right; 
} 

.column-small ul { 
    margin-top: -10px; 
    width: 100%; 
    max-width: 240px; 
} 

.column-small ul li { 
    text-align: left; 
} 

.column-small li { 
    list-style: none; 
    padding: 5px; 
    text-indent: -30px; 
    word-wrap: break-word; 
} 

Screenshot

+0

您已將列 - 小高度設置爲自動;所以它現在在瀏覽器上計算div的高度。 – 2013-02-15 09:23:14

回答

1

第一部分看起來像一個重複的從https://stackoverflow.com/a/10235116/1902425

你的第二個部分:如果你用JS做,你的身高是動態計算的,所以你可以現在的位置是你的「更多」鏈接世界投資報告position: absolute小例子:

<div class="column-small"> 
     <div class="column-content"> 
      <h3>Idont knows</h3> 
      <p>Your content</p> 
     </div> 
     <div class="readmore"><a href="#">Read more</a></div> 
</div> 

CSS:

.column-small { 
    position: relative; 
    height: 240px; 
} 
.readmore { 
    position: absolute; 
    bottom: 10px; 
    right: 10px; 
} 
0

設置高度.column-small div

0
.column-small{ 
    height: inherit !important; 
} 
2

CSS:

.column-wrapper { overflow: hidden; } 

.column-small { 
    float: left; 
    margin: 20px; 
    background-color: red; 
    padding-bottom: 1000px; 
    margin-bottom: -1000px; 
} 

.column-small span { float: right; } 

.column-small ul { 
    margin-top: -10px; 
    width: 100%; 
    max-width: 240px; 
} 

.column-small ul li { text-align: left; } 

.column-small li { 
    list-style: none; 
    padding: 5px; 
    text-indent: -30px; 
    word-wrap: break-word; 
} 

HTML:

<div class="column-wrapper"> 
    <div class="column-small border border-top"> 
     <h3>Features</h3> 

     <ul> 
     <li>Code blocking</li> 
     <li>Code Wrapping</li> 
     <li>Code Killing</li> 
     <li>Code Sleeping</li> 
     </ul> 

     <span><a href="#">Read more</a></span> 
    </div> 

    <div class="column-small border border-top"> 
     <h3>Modules</h3> 

     <ul> 
     <li>Barking Around The house</li> 
     <li>Loving the Cats</li> 
     <li>Floating The points</li> 
     <li>Coding The Sleepers</li> 
     </ul> 

     <span><a href="#">Read more</a></span> 
    </div> 

    <div class="column-small border border-top"> 
     <h3>Idont knows</h3> 
     <span><a href="#">Read more</a></span> 
    </div> 
</div> 
+0

不工作在我的代碼:( – Snippet 2013-02-15 10:12:11

+0

其工作正常,我檢查了我的瀏覽器。 – 2013-02-15 10:18:18

+0

如果工作,然後接受,否則讓我知道確切的問題 – 2013-02-15 10:23:22