AutoCAD 3DMAX C语言 Pro/E UG JAVA编程 PHP编程 Maya动画 Matlab应用 Android
Photoshop Word Excel flash VB编程 VC编程 Coreldraw SolidWorks A Designer Unity3D
 首页 > css教程

overflow:hidden line-height clearfix:after使用方法介绍

51自学网 http://www.wanshiok.com
overflow,hidden,clearfix1.overflow:hidden的作用是隐藏溢出比如

复制代码
代码如下:

<div style="width:300px;overflow:hidden" id=1><div id=2></div><div>

当ID=2的这个DIV高度设定的宽度超过了300px,那么超出的部分将自动被隐藏

2.line-height指的是在DIV中的元素上下居中
比如用在<li>里,则可以将line-height的高度和height的值相等,(height:30px; line-height:30px;)这样可以让文字在<li>内相对于30px垂直居中。比如用在<p>内,像这样成段落的,如果不加line-height,行与行之间距离会很近,若在<p>属性内加上line-height:22px;则每行之间的行距都是22px,会显得不会太拥挤.3.clearfix:after清除浮动css内容如下:

复制代码
代码如下:

.clearfix:after{content: ".";display: block;height: 0;clear: both;visibility: hidden;}
.clearfix{zoom:1;}/*for ie6*/* html .clearfix {height: 1%;}/* for macIe*/

在html代码如下

复制代码
代码如下:

<div style="border:2px solid red;" class="clearfix">这样就可以实现清除浮动了

overflow,hidden,clearfix  
上一篇:css 垂直对齐 css中vertical-align属性(垂直对齐)的使用说明  下一篇:应用before/after伪类时如何CSS命名以及针对ie6/ie7浏览器兼容