閑話少說(shuō),書(shū)歸正傳。能夠簡(jiǎn)寫(xiě)的css屬性主要有以下幾個(gè):
font
簡(jiǎn)寫(xiě):
font:italic small-caps bold 12px/1.5em arial,verdana;等效于:
font-style:italic;
font-variant:small-caps;
font-weight:bold;
font-size:12px;
line-height:1.5em;
font-family:arial,verdana;順序:
font-style | font-variant | font-weight | font-size | line-height | font-family(注:簡(jiǎn)寫(xiě)時(shí),font-size和line-height只能通過(guò)斜杠/組成一個(gè)值,不能分開(kāi)寫(xiě)。)
background
簡(jiǎn)寫(xiě):
background:#fff url(bg.gif) no-repeat fixed left top;等效于:
background-color:#fff;
background-image:url(bg.gif);
background-repeat:no-repeat;
background-attachment:fixed;
background-position:left top;順序:
background-color | background-image | background-repeat | background-attachment | background-positionmargin & padding
簡(jiǎn)寫(xiě):
margin:1px 0 2em -20px;等效于:
margin-top:1px;
margin-right:0;
margin-bottom:2em;
margin-left:-20px;順序:
margin-top | margin-right | margin-bottom | margin-leftpadding的簡(jiǎn)寫(xiě)和margin完全一樣。
border
簡(jiǎn)寫(xiě):
border:1px solid #000;等效于:
border-width:1px;
border-style:solid;
border-color:#000;順序:
border-width | border-style | border-color這三句也是簡(jiǎn)寫(xiě),等于是把四邊的樣式合而為一了。(關(guān)于四邊的問(wèn)題,下文有詳細(xì)說(shuō)明)
border-top / border-right / border-bottom / border-left
簡(jiǎn)寫(xiě):
border-top:1px solid #000;等效于:
border-top-width:1px;
border-top-style:solid;
border-top-color:#000;(和border一樣)
list-style
簡(jiǎn)寫(xiě):
list-style:square outside url(bullet.gif);等效于:
list-style-type:square;
list-style-position:outside;
list-style-image:url(bullet.gif);順序:
list-style-type | list-style-position | list-style-image關(guān)于四邊
有很多樣式都涉及到了四邊的問(wèn)題,這里統(tǒng)一說(shuō)明。
四邊的簡(jiǎn)寫(xiě)一般如下:
新聞熱點(diǎn)
疑難解答
圖片精選