What is the relationship between css selectors
This article mainly introduces what is the relationship between css selectors, the article is very detailed, has a certain reference value, interested friends must read it!
1. Parent element: contains other elements directly, and this element is the parent element of the containing element.
2. Ancestor element: contains other elements. This element is the ancestor element that contains the element.
3. Child elements: elements that are directly contained.
The included element is the child element of the containing element.
4. Descendant elements: included elements.
The included element is the descendant of the containing element.
Example
1. Adjacent selector 1 + selector 2 {}
2. Descendant selector 1 selector 2 {}
3. Subselector selector 1 > selector 2 {}
Adjacent selector li+li {color:springgreen;} descendant selector div span {font-size: 40px;} subselector div > span {background-color: yellowgreen } the first list, the second list, the second list, the third descendant of div, the descendant of span div, the above is all the contents of the article "what is the relationship between css selectors". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!