CSS试题
display:none 和 visibility:hidden 的区别
CSS display:none;
使用该属性后,HTML元素(对象)的宽度、高度等各种属性值都将“丢失”;
visibility:hidden;
使用该属性后,HTML元素(对象)仅仅是在视觉上看不见(完全透明),而它所占据的空间位置仍然存在,也即是说它仍具有高度、宽度等属性值
CSS缩写
background: #00FF00 url(bgimage.gif) no-repeat fixed top;
background-color | background-image | background-repeat | background-attachment | background-position
font:italic small-caps bold 12px/1.5em arial,verdana;
font-style | font-variant | font-weight | font-size | line-height | font-family
color,margin,padding,list-style
首个或全部字母大写或小写
text-transform:
none : 默认无转换发生
capitalize : 将文章中出现每个单词或拼音的第一个字母转换成大写,其余无转换发生
uppercase : 将文章中所有英文单词拼音字母转换成大写
lowercase : 将文章中所有英文单词拼音字母转换成小写
清除浮动的方法
清除浮动的方法
清除浮动的方法
清除浮动的方法
1、clear:both;
2、使用after伪类
使用after伪类和内容声明在指定的现在内容末尾添加新的内容。经常的做法就是添加一个“点”,因为它比较小不太引人注意。
然后我们再利用它来清除浮动(闭合浮动元素),并隐藏这个内容:
#outer:after{ content:"."; height:0; visibility:hidden; display:block; clear:both; }
zoom+overflow组合:代码简单,但是针对于有固定高度的容器可能会出现表现上的问题。
div.container { zoom:1; overflow:auto; }
zoom+:after组合:能够适应所有情况,只是代码多了几行。
div.container { zoom:1; } .container:after { content: “.”; display: block; height: 0; clear: both; visibility: hidden; }
3、第三种方法是这样的,如果子容器浮动时,它的父容器也同样浮动,那么,父容器会自动扩展,以包含子容器。也就是说在父容器也是浮动元素的时候,子容器可以不清除浮动。
当然在使用这种方法的时候你要注意父容器的父容器哦~~呵呵!这个只是保证了子容器不用清除浮动,那么当父容器也浮动起来的时候,它本身的浮动又需要你的谨慎思考去清除了。

浙公网安备 33010602011771号