Closed nicetransition closed 10 years ago
Isn't that what the standard suggests. According to the example:
/* bad */
.selector p {
...
}
/* good */
.selector > p {
...
}
The styling is only applied to the first level p
, not all child p
elements.
I like @kevinmack18 's suggestion, "Use absolute path selectors only when needed". I can't think of a reason why you would completely avoid descendant selectors.
If you want all anchor elements to display a different way within a specific parent, a descendant selector would be fine.
I would recommend removing "Use preferred-child instead of descendant selectors.", there are many cases to use this.
Quick example is a basic horizontal list element where I don't want a sub list to be horizontal:
This is fundamental (syntax) of CSS not a standard.
A better suggestion would be something like "Use absolute path selectors only when needed"