Selector属性selector[filter]在现有选择器的基础上过滤selector[]input[type]input[type=text]input[type^=s]input[type$=t]input[type*=t]伪类selector[filter]表示结构:first-child:last-child:nth-child()number/2n+1/even,odd表示状态:link:hover:active:visited:focus伪元素选择器[添加元素]选择器::after添加一个伪元素到选择器ul.nav::after{content:"four";显示:块;...onetwothree::after规则值:关键字:左侧位置rightcentertopbottommediumcancelsnone...颜色:十六进制#ffffff#ededed,简写为#fffrgbfunctionrgb(0,0,0)keywordgradientlinear-gradientlength:absoluteunitpxrelativeunitemonthecurrentelementFontsizefont-size:12px1em=12px2em=24pxrem当前html元素中设置的字体大小html{字体大小:10px;}ul{字体大小:20px;}li{身高:2rem;//20px}%percentageborder-radius:50%文字样式(可继承)line-heighttext-aligntext-decoration字体样式(可继承)colorfont-familyfamily'微软雅黑','微软雅黑','Arial'字体堆栈font-family:"MicrosoftYaHei","MicrosoftYaHei",serif;font-size网页大小默认字体为16px12px10pxfont-weightthicknessboldthinbolder100~900font-style是否开启斜体line-heightfont:shorthand,shorthandfont:font-stylefont-weightfont-size/line-heightfont-familyfont:normalbold14px/1.5em"MicrosoftYaHei","MicrosoftYaHei"webfontwonderfulfont,(word->icon)----------------------------1。标签选择器2.id选择器3.类选择器4.通用选择器5.父子选择器空格:后代选择器,后面所有后代>:子集选择器,后面6.兄弟选择器+:选择紧跟在选择器后面的标签~:选择选择器后面的所有兄弟标签7.组合选择器交集选择器:并列选择器:逗号连接8.attribute选择器[type=text][type$=t]有类型属性和值以t结尾[type^=t]有类型attributeandvalue以t开头[type*=t]hastypeattributeand9.伪类选择器a。p:first-child:p:last-child:p:only-childofthesamelevel:匹配属于父元素p的元素p:nth-child(n):同级的第一个子元素p:nth-child(odd):同层所有奇数标签p:nth-child(even):同层所有偶数标签b.相同类型(防止同一层级不同类型难以选择)ofthesametypep:nth-of-type(n):同级别第n个同类型标签10.伪元素选择器div::before{content:'aaa'}div::after{content:'aaa'}p::first-letter{选择第一个字符}div::first-line{选择一行}input::selection{选择所选择的}优先级1.!important2。如果选择器权重相同,则最近的3个。内联:1000id选择器:100类选择器,属性选择器,伪类选择器:10标签选择器,伪元素选择器:1