我的問題是我想要一組並排的div。這些div可以增長到任意高度,因此垂直對齊很重要。正如另一個SO帖子所建議的,爲了解決垂直對齊問題,我有一個類似於此的結構。請幫我填空。在瀏覽器中如何使用一個剩餘空間的並排Div?
<div id="main-container">
<div class="formatter">
<div class="content1">
<!--- I am fixed at 200px ---->
</div>
</div>
<div class="formatter">
<div class="content2">
<!--- I have a rendered element. I don't know exactly how high or wide I am, but I'm not going to take up the whole thing. --->
</div>
</div>
<div class="formatter">
<div class="content3">
<!--- I have some text and just want to take up the rest of the main container less padding and borders ----->
</div>
</div>
</div>
顯示:
CSS:
#main-container {
width: 900px;
}
.formatter {
display: inline-block;
vertical-align: middle;
}
.content1 {
float: left;
width: 200px;
}
我想我一定錯過了你問題的一部分,你告訴我們問題是什麼...... –
沒問題,但當我們不知道問題是什麼時,很難提供幫助。哦,你知道嗎,如果你不想要前端工作,我可以看看你,我的諮詢率是合理的競爭...;) –
也許試着找到一些兩列的佈局。 (我敢肯定,你可以找到更多這些,而不是你的問題的確切答案。)然後你做了一個兩列的佈局,其中左列是固定的寬度,右邊是剩下的空間。如果你得到這個工作,那麼也許你可以再次做同樣的事情 - 只有這一次你在左欄內發生同樣的事情。所以你有: '|固定|內容... |' 之後 '| fixed | ... |內容... |' 這可能工作,取決於你會找到什麼樣的解決方案。 –