gpt4 book ai didi

html - div元素排列

转载 作者:太空宇宙 更新时间:2023-11-04 04:43:23 25 4
gpt4 key购买 nike

谁能告诉我为什么#contHolder div 没有被推到第一行?用“任何文本内容”替换表格元素,一切都正确对齐。

<div id="footerWrapper"style="display: block; width:100%;">
<div id="firstCol" style="float:left; width: 30%;">
<div id="footerProjectTitle" style="float: left; width: 100%; background-color:red;">title</div>
<div style="clear:both"></div>
<div id="contHolder"style="float: left; width: 30%; background-color: #ffc0cb;">
<table>
</table>
</div>
</div>
<div id="secondCol" style="float:left; width: 30%;">
<div id="linkHolder"style="float: left; width: 100%; background-color: #f0ffff;">
<table>
</table>
</div>
</div>
</div>

这是一个 fiddle

http://jsfiddle.net/KzJN3/

更新的 fiddle : http://jsfiddle.net/KzJN3/2/

谢谢!

最佳答案

问题出在这里:

<div class="noborder" style="clear: both; width: 100%; height: 0px; line-height: 0px; font-size: 0px;"> </div>

你告诉它 clear:both 所以这个元素之后的任何 float 都将在一个新行上开始。

float 是一个难题,请参阅:http://css-tricks.com/all-about-floats/获取有关它们及其工作原理的一些有用信息。

关于html - div元素排列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14990179/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com