Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个容器,里面有几个浮动的 div。我希望 div 伸展到其内容的完整高度。
我尝试添加overflow:visible到容器中以使其扩展,还添加了 aclear但似乎都不起作用。
overflow:visible
clear
此处提供实时站点链接
您需要在 div 中放置未浮动的内容并清除它。
<div class="magical-div> <div class="float1"> content </div> <div class="float2"> content </div> <div style="display:block;clear:both;"> </div> </div>