属性选择器
[type=”checkbox”] { }
后代选择器
div .box {
}
子代选择器
div>.box{
}
并集选择器
P1,p2 {
}
伪类选择器
a:link
a:visted
a:hover
a:focus
a:active
伪元素选择器
p::first–line{ }(块级元素
p::first-letter
p.intro::first-letter
P::before{}前面插入
p::after {}后入
:root is a pseudo-class selector that matches the root element of the document, usually the html element. By creating your variables in :root, they will be available globally and can be accessed from any other selector in the style sheet.
行内元素不能选择宽高
可以CSS设置变量
在css选择器的大括号内运用,往后要用的话直接调用。
命名方法:p{–penguin-blue:blue;}
此处–penguin-blue是变量名 而blue是该变量内储存的值
声明方法和别处一样,相当于把该属性转化成了包含一个属性值的变量,可以直接调用,属性变量内的属性值赋值给调用该变量的属性。
调用属性变量的方法,color: var(–penguin-blue,black);
black是一个备用值,如果–penguin-blue不可用,则选择black。
CSS复合选择器和css变量
最新推荐文章于 2023-08-23 14:35:40 发布