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

auto和100%的区别

时间:2014-10-21 23:05:02      阅读:379      评论:0      收藏:0      [点我收藏+]

标签:style   div   ef   as   text   class   height   c   元素   

auto是随内容的高度而撑开的。100%是根据父级元素的高度来决定的。
例如:
<div style="height:100px;width:200px;">  

<div style="height:auto;width:100px;float:left;">这个容器的高度是随里面的内容的高度而定</div>
<div style="height:100%;width:100px;float:right;">这个容器的高度为父级的高度,100px</div> </div>
并且:width:auto总是占据整行。

auto和100%的区别

标签:style   div   ef   as   text   class   height   c   元素   

原文地址:http://www.cnblogs.com/sky8-/p/4041747.html

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