1.overflow:hidden的作用是隱藏溢出比如:<div style="width:300px;overflow:hidden" id=1><div id=2></div><div>當(dāng)ID=2的這個(gè)DIV高度設(shè)定的寬度超過了300px,那么超出的部分將自動(dòng)被隱藏
2.line-height指的是在DIV中的元素上下居中
比如用在<li>里,則可以將line-height的高度和height的值相等,(height:30px; line-height:30px;)這樣可以讓文字在<li>內(nèi)相對(duì)于30px垂直居中。比如用在<p>內(nèi),像這樣成段落的,如果不加line-height,行與行之間距離會(huì)很近,若在<p>屬性內(nèi)加上line-height:22px;則每行之間的行距都是22px,會(huì)顯得不會(huì)太擁擠.
3.clearfix:after清除浮動(dòng)css內(nèi)容如下:.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">
這樣就可以實(shí)現(xiàn)清除浮動(dòng)了
新聞熱點(diǎn)
疑難解答
圖片精選