1.1 直接选择器
.class
.test-Class {
color: red;
}
<p class="test-Class">测试 .class 选择器</p>
#id
#test-id {
color: aqua;
}
<p id="test-id">测试 #id </p>
*
* {
background-color: azure;
}
element
h1 {
color: red;
}
<h1>测试 element </h1>
element,element
h1,h2,h3 {
color: red;
}
<h1>测试 element,element </h1>
<h3>测试 element,element </h3>
<h5>测试 element,element </h5>
:root
:root {
background-color: aliceblue;
}
:not(selector)
.test {
color: orange;
}
:not(.test) {
color: red;
}
<p>ppp</p>
<p class="test">ppp</p>
:empty
p:empty {
background-color: red;
height: 30px;
}
<p></p>