Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

css grouping selectors

Without grouping we could do:

.footer_content a:link {
    color: #FFFFFF;
}
.footer_content a:visited {
    color: #FFFFFF;
}

With grouping:

.footer_content a:link, .footer_content a:visited {
    color: #FFFFFF;
}

is there a way to define the css selector to get rid of the extra .footer_content declaration that does the same thing? Something that would looking a bit like this:

.footer_content (a:link, a:visited) {
    color: #FFFFFF;
}
like image 633
Alan Avatar asked Dec 19 '25 22:12

Alan


2 Answers

There currently is not a universally supported way of achieving that.

However, the experimental :any() selector would make that possible, if it gets implemented and standardised. It is not supported in any browser but the latest Firefox nightlies yet.

like image 127
alex Avatar answered Dec 24 '25 03:12

alex


You can achieve something kinda similar with Sass, which "compiles down" to CSS.

In Sass you would use nesting, like so:

.footer_content {
  a:link, a:visited {
    color: #FFFFFF;
  }
}
like image 35
Jits Avatar answered Dec 24 '25 05:12

Jits



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!