float引起层飘出父层的解决方法
.clearfix:after {
content: “.”; display: block;
height: 0;
clear: both;
visibility: hidden;}
.clearfix {display: inline-block;}
/* Hides from IE-mac */
* html .clearfix {height: 1%;}
.clearfix {display: block;}/* End hide from IE-mac */
.clearfix {
display: block;
margin: 0px;
clear: both;
padding: 0px;
visibility: hidden;
background-color:#666666;
border:0px none #FFFFFF;
}
.clearfix:after { height: 1px;}
使用方法:
在所有浮动层之后加上这个层
<div class=”clearfix”></div>
2.把背景层加浮动,但是这个方法会影响其他的div,有时候好用。
3.加 overflow 这个也有问题,会影响div的外观。
div+css布局必了解的列表元素ul ol li dl dt dd详解
块级元素div尽量少用,其实和table一样,嵌套越少越好,它也是会影响速度的!ol有序列表。olli……/lili……/lili……/li/ol表现为:1……2……3……ul无序
CSS Hack收集汇总
屏蔽IE浏览器(也就是IE下不显示)*:lang(zh)select{font:12px!important;}/*FF的专用*/select:empty{font:12px!important;}/*safari可见*/这里select是选择符,根据情况更换。第
区分IE6,IE7,firefox的CSS hack
区别IE6与FF:background:orange;*background:blue;区别IE6与IE7:background:green!important;background:blue;区别IE7与FF:background:orange;*background:green;区别FF,IE7,IE6:background: