English website ref:
https://www.w3schools.com/cssref/css_selectors.asp
Chinese website ref:
https://www.runoob.com/cssref/css-selectors.html
Select all element and set background color:
* {
background-color:yellow;
}
Select all element inclosed by div:
div * {
background-color:yellow;
}
Class selector:
.intro {
// select all elements their has class="intro" marker
}
Id selector:
#firstname {
// select all elements their has id="firstname" marker
}
Element selector:
div {
// all div tag will be selected
}
Element,Element selector:
div,span {
// select all div and span tag
}
Element Element selector:
div span {
// select all span tags that inclosed by div tag
}
Element>Element selector:
div>p {
// select all p elements their father element is div
}
Top comments (0)