我明白到
的标签有意义,因为它更具语义.但是,如果您仍然需要清除块以使基于列的布局工作,我不明白获得的好处.例如:
<!-- Note: location-info & personal-info both float left. --> <div class="contact"> <div class="personal-info"> <p> Shawn,etc,etc </p> </div> <div class="location-info"> <p><address>etc</address></p> </div> <br style="clear:both" /> <!-- clearing block --> </div>
解决方法
如果我告诉你
you
didn’t
need清除块怎么办?
.clear-block:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } .clear-block { display: inline-block; } <div id="wrapper" class="clear-block"> <div style="float:right"> Your content here </div> <div style="float:left"> More content here </div> </div>