CSS Direct Children Selector
Selectors is
a core feature of CCS technology. It assist us to define the set of elements to
affected a CSS attributes. One important
feature is to understand how to filter elements based in its level in the DOM (Document
Object Model).
The name cascading
(from CSS – Cascading Style Sheet) is so, because by default a certain rule is
applied to all its children (no matter
the level), it is the example for the selector below:
body table{
display:none;
}
It will take all tables under body table, no matter if they are direct under body or in some sublevel of the elements tree. However, if the goal is to affect only elements there are direct children form body, it is possible to use the following syntax (>), indicating it should not cascading, but just the first level elements that match the selector.
body > table{
display:none;
}
A source code
of the usage of this selector is available here: https://github.com/rafaelqg/code/blob/main/css_direct_children_selector.html
You may
also see a video class about this theme here:
Comments
Post a Comment