笔记:清除浮动方法
来源:互联网 发布:网络诈骗案一般关多久 编辑:程序博客网 时间:2024/06/18 16:00
方法出处:[http://www.cnblogs.com/zhongweizhu/p/6003537.html]
第一种:增加一个空的div,通过设置css清除浮动
<style>.clearfix{ clear: both; }</style><body> <div class="box1">div1</div> <div class="box2">div2</div> <div class="clearfix"></div> <!--增加的div 只用于清除浮动--> <div class="box3">div3</div></body>
第二种:使用overflow:hidden/auto实现
<style> .box{ background-color: yellow; overflow:atuo; //或者是hidden } .box1{ width: 100px; height: 100px; background-color: green; } .box2{ width: 100px; height: 100px; background-color: red; }</style><body><div class="box"> <div class="box1">div1</div> <div class="box2">div2</div></div></body>
第三种:使用伪元素::after实现
<style> .clearfix:after{ content:""; display:table; height:0; visibility:both; clear:both; } .clearfix{ *zoom:1; /* IE/7/6*/ }</style> <body><div class="box clearfix"> <div class="box1">div1</div> <div class="box2">div2</div></div></body>
阅读全文
0 0
- 笔记:清除浮动方法
- 清除过浮动方法 清除浮动大全
- 清除浮动的方法
- 清除浮动的方法
- 清除浮动常用方法
- 清除浮动的方法
- 清除浮动的方法
- 清除浮动的方法
- CSS清除浮动方法
- 清除浮动方法
- 清除浮动的方法
- 清除浮动的方法
- 清除浮动的方法
- 清除浮动的方法
- 清除浮动方法
- 清除浮动的方法
- 清除浮动方法汇总
- 清除浮动方法
- C++ Primer 10 关联容器
- AssetBundle
- Python基础语法
- 协方差的意义和计算公式
- (转)聚集索引和非聚集索引(整理)
- 笔记:清除浮动方法
- About博主
- java代码中调用存储过程导致的事务失效
- 02_核心概念--06_事件
- 自定义TitleBar
- 【8086汇编】基础排序之直接插入排序
- C语言-变量的类型
- synchronized 线程同步的三种方法
- 利用File获取磁盘信息