嵌套的margin-top无效
2013-06-04 15:52
169 查看
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>margin-top无效</title> </head> <style> body{ padding:0; margin:0; background:#cccccc;} .box1{ width:500px; margin:0 auto; background:yellow; overflow:hidden;} .box2{ width:100px; height:100px; border:1px #000 solid; margin-top:10px;} </style> <body> <div class="box1"> <div class="box2">box2</div> box1 </div> </body> </html>
ie6下:
谷歌下:
解决方法:
在外层样式加:overflow:hidden;
相关文章推荐
- Div嵌套引起子元素的margin-top不起作用
- FF浏览器嵌套div中margin-top转移问题的解决办法
- margin-top失效, css + div 布局之 CSS盒模型 外边距合并问题 问题表述: 那天晚上一个同学给我发来一个问题,原型大概是“一个maindiv嵌套了一个div.class="he
- CSS 之 嵌套 margin-top 处理
- div嵌套引起的margin-top不起作用
- div嵌套引起的margin-top不起作用
- DIV多层嵌套margin-top的BUG问题
- 在CSS中span标签设置padding-top/bottom以及margin-top/bottom无效的解决方法
- margin-top 无效,避开麻烦的margin叠加(margin collapsing)
- margin-top无效解决方法
- 关于margin-top无效问题
- 关于DIV多层嵌套的margin-top的BUG
- FF浏览器嵌套div中margin-top转移问题的解决办法
- margin-top无效的问题解决方法
- CSS:span元素margin-top无效的根源
- 关于DIV多层嵌套的margin-top的BUG
- div中嵌套div中使用margin-top失效问题
- 两个嵌套的Div,内部Div的margin-top失效
- 小菜学习日记—div嵌套导致子区域margin-top失效问题(外边距合并问题)
- 盒子的margin塌陷问题解决方案(嵌套盒子出现margin无效)