1.通配符 *css
2.類選擇器html
1 .myContent{ 2 font-size:18px; 3 }
3.包含選擇器spa
1 p strong{ 2 color:#000; 3 }
4.子選擇器code
1 p>strong{ 2 color:#000; 3 }
包含選擇器和子選擇器的區別在於包含選擇器是找p標籤下的全部後代strong,而子選擇器只是找子元素中的stronghtm
5.相鄰選擇器blog
1 p+strong{ 2 color:#000; 3 }
相鄰選擇器是匹配同一個父級下某個元素以後的元素。input
6.屬性選擇器it
E表示任何一個html標籤,能夠是通配符*class
1 *[class]{ 2 color: #DDD; 3 } 4 input[type='text']{ 5 text-align:center; 6 } 7 p[title~='css']{ 8 font-size:14px; 9 } 10 p[title|='css']{ 11 font-size:20px; 12 }
7.ID選擇器 di
1 #myContent{ 2 font-size:18px; 3 }
8.選擇器組合