当前位置:首页 > Web开发 > 正文

标签: 类 id 元素选择器li class=red1/lili id=blue2/lili class=red3/l

2024-03-31 Web开发

标签:

类 id 元素选择器 <li class="red">1</li> <li id="blue">2</li> <li class="red">3</li> <li>4</li> <style> .red{color:red;} #blue{color:blue;} li{color:green;} *{font-size:16px;} </style> 伪类选择器 <a href=http://www.mamicode.com/"https:/www.baidu.com">链接</a> <style> a:link{color:blue;} a:visited{color:grey;} a:hover{color:red;} a:active{color:yellow;} </style> 且 E:focus E:not() E:empty E:checked E:enabled E:disabled E:first-child 同一层排行第一 E:nth-child(n) E:nth-last-child(n) E:last-child E:only-child E:first-of-type 同一层细分范围第一 E:nth-child(n) E:nth-last-child(n) E:last-of-type E:only-of-type 伪元素选择器 内的 E::first-letter E内的第一个字母 E::first-line E内的第一行 E::before E内的最前面 E::after E内的最后面 属性选择器

```css
^开始 $结尾 *包罗
E[att]
E[att="val"]
E[att^="val"]
E[att$="val"]
E[att*="val"]
包罗val并用空格分隔断绝分手
E[att~="val"]
以val开头并用连接符"-"分隔断绝分手
E[att|="val"]

CSS选择器归类举例

温馨提示: 本文由Jm博客推荐,转载请保留链接: https://www.jmwww.net/file/web/32327.html