Is it possible in CSS/SASS/LESS to combine multiple selectors with the same attribute into one selector without repeating the attribute?
For example:
div.foo[data="123"] {
color: red;
}
p.bar[data="123"] {
color: red;
}
p.bar[data="123"], div.foo[data="123"]{
color: red;
}
Combine them somehow? Such as this invalid scenario:
(div.foo, p.bar)[data = "123"] {
color: red;
}
You could do it like that:
div.foo,
p.bar {
&[data="123"] {
color: red;
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.