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.选择器组合