小編給大家分享一下css中實(shí)現(xiàn)DIV高度自適應(yīng)的方法,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!

可以添加表格特性。
父級(jí)元素添加屬性 display: table;
子一級(jí)元素添加屬性 display: table-cell;
代碼:
<div class="div-row">
<style type="text/css">
.div-row {
width: 400px;
border: 1px solid #23527C;
display: table;
}
.div-col {
display: table-cell;
}
</style>
<div class="div-col" style="background-color: #28A4C9;">
<p><span>內(nèi)容1</span></p>
</div>
<div class="div-col" style="background-color: #31B0D5;">
<p><span>內(nèi)容1</span></p>
<p><span>內(nèi)容2</span></p>
</div>
<div class="div-col" style="background-color: #269ABC;">
<p><span>內(nèi)容1</span></p>
<p><span>內(nèi)容2</span></p>
<p><span>內(nèi)容3</span></p>
</div>
<div class="div-col" style="background-color: #5BC0DE;">
<p><span>內(nèi)容1</span></p>
<p><span>內(nèi)容2</span></p>
<p><span>內(nèi)容3</span></p>
<p><span>內(nèi)容4</span></p>
<p><span>...</span></p>
</div>
</div>結(jié)果:

以上是css中實(shí)現(xiàn)DIV高度自適應(yīng)的方法的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對(duì)大家有所幫助,如果還想學(xué)習(xí)更多知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)-成都網(wǎng)站建設(shè)公司行業(yè)資訊頻道!
網(wǎng)站題目:css中實(shí)現(xiàn)DIV高度自適應(yīng)的方法-創(chuàng)新互聯(lián)
URL分享:http://chinadenli.net/article6/shcig.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供網(wǎng)站收錄、服務(wù)器托管、移動(dòng)網(wǎng)站建設(shè)、全網(wǎng)營(yíng)銷推廣、網(wǎng)站設(shè)計(jì)公司、網(wǎng)頁(yè)設(shè)計(jì)公司
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容