我在另一个 div 中有一个左浮动 div,并且浮动 div 内容正在从父级中移出。
观看直播:
http://jsfiddle.net/eWkUg/
* {
margin: 0;
padding: 0;
list-style: none;
}
ul {
width: 600px;
}
ul li {
border: solid 1px #000;
margin: 15px 0;
}
.img-section {
float: left;
border: solid 1px red;
}
<ul>
<li>
<div class="img-section">
<img src="http://www.placehold.it/50X100">
</div>
Hello world
</li>
<li>
How to avoid the red box getting out of the black one? (and hiding another list element)
</li>
</ul>
我一直在尝试明确:左/右/两者,但没有任何帮助。
如何避免这种情况?由于图像覆盖(不包括在上面的示例中),我必须浮动整个 div(而不是内容)
您可以通过添加来修复它overflow:auto to ul li
,如果我正确理解你的问题。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)