CSS thorough research (1)
Github pages blog post
Basic selector
Mark selector h1 {...}
category.class_name{...}, two classes work at the same time, such as class = 'one two', in case of conflict, choose the former
ID selector #id{...}
Compound selector: two or more selectors, connected in different ways
Intersection
h3.class_name { ... }
The first one must be a tag selector, the second one must be (category selector) or (ID selector), there is no space in the middle, it must be written continuously
The union selector a_selector, b_selector is multiple Selector
Descendant selector
div p { /* p below div, including all descendants*/}
div>direct descendants of pdiv
CSS inheritance
The contained small container will inherit the containing it The style of the large container
The result is as follows Figure, em inherits the underline of h1
CSS priority
inline style (style=) > ID style (#id) > class style (.class) > mark style (div)
two classes conflict When choosing, choose the former
The above is the content of CSS thorough research (1). For more related content, please pay attention to the PHP Chinese website (www.php.cn)!