CSS - Descendant Selectors
CSS - Descendant Selectors
Descendant Selectors in CSS
CSS descendant selector styles all the tags that are children of a particular specified tag. A single space between the parent element and child element is used to mention a descendant.
Syntax
The syntax for CSS descendant selectors is as follows:
CSS CODE
selector_1 selector_2 {
/* property: value; */
color: #04af2f
}Descendant Selectors Example
In this example, we have set aborderfor all thepelements inside adivelement. The p elements outside the div element will not have any styles applied to them.
Preview
Example 2
In this example, we have used CSStransition propertywithrotate()function of CSStransform propertyto rotate the written text of the div element with the class namecontainer.
Preview