我已經看到一些類似的問題,但沒有真正全面的解決這個特定問題;如果有關於此的一個好線索,我不知何故錯過了,我提前道歉。獲取表格以正確地與其他divs進行堆疊
所以我有一個多部分問題,我的第一部分的解決方案創建了第二個問題。
我有一個4列布局,其中的內容需要均勻地保持在同一高度,這樣的事情:
第二個和第四個盒子裏將有一個背景顏色和高度需求保持在與其他兩個相同的高度,這將是圖像。目前我能找到實現這一目標的最可靠的方法是將其標記如表和單元格高度設置爲100%,像這樣:
<table>
<tbody>
<tr>
<td style="width: 25%;">
<figure><img alt="" class="img-responsive" src="http://lorempixel.com/1000/1000/business" /></figure>
</td>
<td class="bg-brand-dark" style="height: 100%; width: 25%;">
<div class="block-padding-hor">
<h3 class="text-inverse h6"><strong>Featured Corporate News</strong></h3>
<hr class="rule-part--bright center-block" />
<p class="text-inverse h6">Hardly Dude, a new 'vette? The kid's still got, oh, 96 to 97 thousand, depending on the options.</p>
<p class="text-center"><a class="currentURL" href="">Continue Reading</a></p>
</div>
</td>
<td style="width: 25%;">
<figure><img alt="" class="img-responsive" src="http://lorempixel.com/1000/1000/business" /></figure>
</td>
<td class="bg-gray-dark" style="height: 100%; width: 25%;">
<div class="block-padding-hor">
<h3 class="text-inverse h6"><strong>Featured Corporate News</strong></h3>
<hr class="rule-part--bright center-block" />
<p class="text-inverse h6">Hardly Dude, a new 'vette? The kid's still got, oh, 96 to 97 thousand, depending on the options.</p>
<p class="text-center"><a class="currentURL" href="">Continue Reading</a></p>
</div>
</td>
</tr>
</tbody>
</table>
這解決了我的第一個問題非常好,但創造一個新的。我添加此標記下的任何後續內容被「侵佔」,由臺上面,像這樣(「不希望」是什麼目前發生的事情):
所以我的問題是,是否有一個良好的可靠的方法來減輕這一點?我只是假設一個表的行爲類似於一個塊元素並相應地堆棧,但這似乎並不是這種情況。提前感謝您提供任何建議,即使這是一個不必要的苛刻詞彙,並附帶一個解決此問題的預先存在的線索。
::編輯::
我並沒有包括任何CSS的,因爲它是不可能任何它正在對這個產生影響,但如果它似乎有必要了解這個問題只是評論,我會加它
::編輯2 ::
每請求,在這裏添加CSS不過,就像我說的,它大多隻是設置背景顏色和居中的事情:
<style>
.img-responsive {
max-width: 100%;
}
.bg-brand-dark {
background-color: #004892;
}
.block-padding-hor {
padding-left: 30px;
padding-right: 30px;
}
.rule-part--bright {
border: 2px solid #08b5fe;
width: 50%;
}
.center-block {
margin: 0 auto;
}
.text-inverse {
color: #ffffff;
}
.h6 {
font-size: 13px;
}
.text-center {
text-align: center;
}
.bg-gray-dark {
background-color: #4D4F53;
}
</style>
是的,需要CSS來更好地理解它。 – divy3993
是的,我只是想說「請不要發佈任何CSS!讓我們猜!」 –
這是我可以看到你的問題https://jsbin.com/rijomi/edit?html,css,js,output。 PS:你爲什麼會用