码迷,mamicode.com
首页 > 其他好文 > 详细

父亲浮动,子代也会跟着走

时间:2016-03-05 13:02:36      阅读:169      评论:0      收藏:0      [点我收藏+]

标签:

 1 <!doctype html>
 2 <html>
 3     <head>
 4         <meta charset="UTF-8"/>
 5         <title>无标题文档</title>
 6          <style>
 7          #a{width:500px;height:500px;border:solid black 4px;}
 8         p{width:100px;height:100px;background:yellow;}
 9         .s{float:right;width:200px;height:200px;background:red;}
10          </style>
11     </head>
12     <body>
13     <div id="a"> 
14       <div class="s">
15        <p></p>
16        </div>
17        
18     </div>
19     </body>
20 </html>
21 </html>

这个时候p也会到右边只不过紧贴着s的左边

父亲浮动,子代也会跟着走

标签:

原文地址:http://www.cnblogs.com/hduhdc/p/5244417.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!