Compare Grouping and Nesting in CSS ?

Asked: Apr 14, 2023

Grouping: Selectors can be grouped having the same values of property and the code be reduced.
h1 {color: blue;}h2 {color: blue;}p {color: blue;}
It can be seen from the code that every element shares the same property. Rewriting can be avoided by writing each selector separated by a comma.
Nesting: Specifying a selector within a selector is called nesting.
P{color: red;text-align: left;}.marked{background-color: blue;}.marked p{color: green;}

Asked by brijesh

Answers (0)

No answers yet. Be the first to answer!