Simple Question: what’s the proper way to write a CSS selector with a class AND a pseudo class?
For example:
a.someclass:active {
top:1px;
}
or
a:active.someclass {
top:1px;
}
Which is correct? If possible, can you give me a source on this – such as a W3C reference? I tried to find it but alas I could not.
They are both correct, although the first one is more common.
Here’s what’s specified in the CSS grammar. You can see that the
.classand:pseudoselectors are both allowed in the same places, along with#idand[attrib=val]selectors: