主題,架子(時間架子,空間架子,三角架),素材。css
三種方式字體
祖父 孫code
p em {color:red;}
父 子繼承
p > em {color:red;}
緊鄰同胞get
h2 + p {color:red;}
通常同胞input
h2 ~ a {color:red;}
通用it
* {color:red;}
.class1 {color:red;}
#id1 {color:red;}
選擇帶有屬性名的標籤io
img[title] {color:red;}
img[title="red"] {color:red;}
a:link {color:black;} a:visited {color:gray;} a:hover {text-decoration:none;} a:active {color:red;}
一個冒號表示僞類,兩個冒號表示CSS3新增的僞類。ast
input:focus {border:1px solid blue;}
:first-child :last-child
e:nth-child(n)
n能夠是數字也能夠是odd,evenclass
p::first-letter {font-size:300%;}
首字母放大
e::before e::after
元素先後
可繼承:顏色,字體,字號。
不可繼承:邊框,外邊距,內邊距。
層層疊加,用最後一個。
順序以下:
默認樣式
用戶樣式
做者連接樣式(按照連接的前後順序)
做者嵌入樣式
做者行內樣式
特指度高的勝出。
p {font-size:12px;} .large {font-size:16px;}
I-C-E最大的勝出。
P p.largetext p#largetext body p#largetext body p#largetext ul.mylist body p#largetext ul.mylist li 0-0-1 0-1-1 1-0-1 1-0-2 1-1-3 1-1-4 =1 =11 =101 =102 =113 =114
順序決定權重。
最後聲明勝出。
文本值 數字值(絕對值,px。相對值,em。) 顏色值