css测试题

来源:互联网 发布:服务器ip及端口 编辑:程序博客网 时间:2024/05/16 13:50

禁止系统滚动条

html,body{    height: 100%;    overflow: hidden;}

清除浮动(至少三种)

1.方法一:给父级加高度2.方法二:给父级浮动,或者开启绝对定位,固定定位3.方法三:overflow: hidden4.方法四:空标签清除浮动 clear: both;5.方法五:<br clear="all" />6.方法六:伪元素        .clearfix:after{             content:'';             display: block;             clear: both;        }

怎么设置块元素水平垂直居中

方法一:/*position: absolute;*/position: fixed;top:0;left: 0;bottom: 0;right: 0;background: deeppink;margin: auto;方法二:父级开启:position:reletive;子级开启:position:absolute;top:50%;left:50%;margin:height/2 0 0 weight/2;

怎么处理图片之间的缝隙(至少两种解决方案)

方法一:父元素  font-size: 0;方法二:<img src="img/1.jpg"><!--      --><img src="img/1.jpg">      图片标签之间写注释符方法三:img{float: left;}

伪元素与元素的区别

无法通过JS获取其DOM
无法通过浏览器直接查看

伪元素默认是 inline

原创粉丝点击