1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | <!DOCTYPE html> < html > < head > < meta charset = "utf-8" /> < title >NEC:更好的CSS方案</ title > < meta name = "keywords" content = "" /> < meta name = "description" content = "" /> < meta name = "viewport" content = "width=device-width" /> < link rel = "stylesheet" href = "css/style.css" /> < link rel = "shortcut icon" href = "img/favicon.ico" /> < link rel = "apple-touch-icon" href = "img/touchicon.png" /> </ head > < body > </ body > </ html > |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | < body > <!-- 側(cè)欄內(nèi)容區(qū) --> < div class = "m-side" > < div class = "side" > < div class = "sidein" > <!-- 熱門標(biāo)簽 --> < div class = "sideblk" > < div class = "m-hd3" >< h3 class = "tit" >熱門標(biāo)簽</ h3 > </ div > ... </ div > <!-- 最熱TOP5 --> < div class = "sideblk" > < div class = "m-hd3" >< h3 class = "tit" >最熱TOP5</ h3 > < a href = "#" class = "s-fc02 f-fr" >更多?</ a ></ div > ... </ div > </ div > </ div > </ div > <!-- /側(cè)欄內(nèi)容區(qū) --> </ body > |
如果可以寫成<div></div><div></div>那么就不要寫成<div><div></div></div>
比如<div><h2></h2></div>已經(jīng)能滿足要求,那么就不要再寫成<div><div><h2></h2></div></div>
比如不要出現(xiàn)這種情況:<div class="class1 class2 class3 class4"></div>
比如在這樣一個列表中,li標(biāo)簽中的itm應(yīng)去除:<ul class="m-help"><li class="itm"></li><li class="itm"></li></ul>