1.display:block 顯示塊元素;
display:inline顯示內(nèi)聯(lián)元素;
2.塊元素:顯示一行,沒有寬度默認撐滿一行,支持所有css命令
內(nèi)聯(lián)元素:寬高有內(nèi)容撐開,不支持寬高,一行上可以顯示同類標簽,不支持上下margin,代碼換行解析。
in-line block:塊元素一行顯示,內(nèi)聯(lián)支持寬高,沒有寬度時內(nèi)容撐開。
3.after偽類,加高,margin auto,空標簽,<br clear="all"/>,
overflow:hidden
after;加選擇器上方便
4.BFC (block formatting context) 塊格式化上下文 標準瀏覽器下才有
5.position-relative相對定位 position-absolute絕對定位 position-fixed固定定位 static默認值 inherit繼承父級元素
6.絕對定位 a 使元素脫離文檔流(提升層級),b內(nèi)聯(lián)支持寬高,塊內(nèi)容撐開 c定位父級相對于定位父級發(fā)生偏轉(zhuǎn),沒有定位,對于doc發(fā)生偏轉(zhuǎn) d相對定位配合絕對定位使用
相對定位 a不影響本身特性 b不使元素脫離文檔流 c沒有定位偏移量,對元素?zé)o影響 d提升層級
固定定位:相對整個文檔定位
7.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文檔</title><style>
body{margin:0;}
.div1{width:50px;height:50px;background:red;position:relative;margin:100px auto;}
.div2{width:50px;height:50px;background:yellow; position:absolute;left:-6px;top:-6px;}</style>
</head>
<body>
<div class="div1">div1
<div class="div2">div2</div></div>
</body>
</html>
8.<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>無標題文檔</title><style>
body{margin:0;}
.div1{width:50px;height:50px;background:red;position:relative;margin:100px auto;opacity:0.5;}
.div2{width:50px;height:50px;background:yellow; position:absolute;left:-6px;top:-6px;}</style>
</head>
<body>
<div class="div1">div1
<div class="div2">div2</div></div>
</body>
</html>
9.colspan 屬性規(guī)定單元格可橫跨的列數(shù)。
rowspan 屬性規(guī)定單元格可橫跨的行數(shù)。
10.margin:50%;