我将 DIV以像素和 DIV以百分比浮动。哪个工作得很好。
但是每当我使用清除:百分比DIV 内部其他内容都会跳转。但我必须在其中使用 clear:both ,因为我在里面浮动另一个DIV。
<div style="width: 100%;">
<div style="width: 100px; height: 200px; background: blue; float: left;"></div>
<div style="background: green;">
aaa
<div style="clear: both"></div>
aaa
</div>
</div>
答案 0 :(得分:0)
Clear:both
不允许任何div在右侧或左侧浮动。
尝试提供height
财产。
所需的输出不清楚。
编辑:
使用
<a href="<?php echo 'http://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; ?>"><img src="images/logo.png"></a>
使用&#39; &#39; (单引号)而不是&#34; &#34;在回声之后/将结束它。
编辑2:
<div style="width: 100%;">
<div style="width: 100px; height: 200px; background: blue; float: left;"></div>
<div style="background: green;width:100%;">
<div style="background-color:red;width:100px;float:left;">
Product 1
<div style="">
Header
</div>
</div>
<div style="background-color:red;width:100px;float:left;">
Product 2
<div style="">
Header
</div>
</div>
</div>