How could I simplify this expression?
.rss,
.rss:hover {
background-color: #ff8900;
}
If there is any way of using like this?
.rss, &:hover {
background-color: #ff8900;
}
How could I simplify this expression?
.rss,
.rss:hover {
background-color: #ff8900;
}
If there is any way of using like this?
.rss, &:hover {
background-color: #ff8900;
}
Not sure if it does simplify, but one option could be using parent selector &
as follows:
.rss {
&, &:hover {
background-color: #ff8900;
}
}
In this approach you could specify which declarations should be shared between .rss
and .rss:hover
.
Another option could be extend
ing the .rss
as @Harry pointed that out:
.rss {
background-color: #ff8900;
&:hover:extend(.rss) {};
}
This method is helpful if both .rss
and .rss:hover
should have the same set of CSS declarations.
As can be seen, in this particular instance both of the above methods don't really simplify the selectors but they might help in more complex situations.