1/*To Select All Children */
2.parent > *
3
4/*To Select a specific Child eg, with class .box */
5.parent > .box
1The descendant combinator — typically represented by a single space ( )
2character — combines two selectors such that elements matched by the second
3selector are selected if they have an ancestor
4(parent, parent's parent, parent's parent's parent, etc)
5element matching the first selector.
6
7example:
8 h1 ul {
9 border : 1px solid #f1f1f1;
10}
11Explanation: This above CSS code snippet will select all the 'ul' (unordered list)
12 tags which are preceeded by an 'h1' (header tag).
13/*the best way to understand is to practice by implemetation.
14Create a html file with lots of h1 and ul elements to understand by
15implementing CSS on them*/
1/*
2 Descendant selectors are used to match to any nested element.
3 Child combinators, on the other hand, only match to the direct
4 child element and are defined by the greater than symbol.
5 The selector on the right must be the direct child of the element
6 on the left.
7*/
8/* child combinator */
9 parent > child {...}
10
11/* descendant selector */
12 parent child {...}
13 ancestor descendant {...}
14