2017/11/28

1. 浮动的元素脱离了文档流,包围图片和文本的div不占据空间。如果,想让包围,需要在这个元素的某个地方应用clear。如

 <div class="news">
     <img src="atol.jpg" width="120" height="180" />
     <p>One of the most impressive flights ever has to be landing at Male airport in the Maldives. As the plane descends, stretching before you is a sea of azure blue reefs and atolls. The engines ease off and the plane gently floats down, almost skimming the water before finally touching down. Male airport sits on it's own private Atoll so transfers to your hotel are either by speedboat or, if you're lucky, by sea plane. Beats descending into Heathrow airport and then fighting your way to the train or bus station any day.</p>
     <div class="clear"></div>
 </div>
 .clear{
         clear: both;
       }

 2.display:block;比较常用于<a><span>这两个标签,因为他们不是块级元素,定义display:block属性后,定义width、height等和长宽相关的css属性才会生效。

posted @ 2017-11-28 10:53  dthui  阅读(100)  评论(0编辑  收藏  举报