Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Multiple selector with the same pseudo-class [duplicate]

Is there a neater way to have one pseudo-class for multiple selector?

For example:

th:first-of-type, td:first-of-type {
    text-align: left;
}
like image 749
Champop Avatar asked May 27 '26 14:05

Champop


1 Answers

Not in CSS, but if you were using a preprocessor like Sass you could organize it a bit like this. (Note that the CSS produced will still compile to your original example.)

th,
td {
  &:first-of-type {
    text-align: left;
  }
}
like image 153
Jon Uleis Avatar answered May 30 '26 04:05

Jon Uleis