DEV Community

loading...

Grouping in CSS

timothyagevi profile image TimothyAgevi ・1 min read
h2 {
    color: red;
}

.thisOtherClass {
    color: red;
}

.yetAnotherClass {
    color: red;
} 
Enter fullscreen mode Exit fullscreen mode
  • In Grouping we separate selectors with commas (,) Alternative of the above 10 lines of code is as shown below:
h2, .thisOtherClass, .yetAnotherClass {
    color: red;
}
Enter fullscreen mode Exit fullscreen mode

Discussion (0)

Forem Open with the Forem app