An element (SPAN or other wise) can have as many classes as you’d like; that’s the beauty of classes. On CSS technique, commonly known as ‘opt-in classes’ takes advantage of this fact, allowing you to separate common properties and add them as need be. For example you could define a class of shapes (square , circle) , and a separate for color ( red, blue, green)
it’s important to know about CSS specify to best take advantage of this.
SECOND: It is NOT inside an ‘href’. What you are referring to is actually called an “attribute selector”. CSS allows you to target an element via any valid attribute and it’s value.
a[href] = the anchor (A) tag with the attribute HREF present. ( as opposed to a plain anchor with has no HREF attribute.
would allow you to style any links for the SP forum section differently from links to an article section. You wouldn’t even have to assign specific classes either, the value of the attribute would serve as the selector.
As Ryan said - that has nothing to do with a[href] matching <a href=""> which has an empty href attribute. a[href] doesn’t check for a non-empty href, it checks for whether the href exists or not (and matches even if it is empty as long sas it actually exists)
<a> tags with a href attribute behave differently from those without even with CSS since :link :visited :focus :hover and :active only apply where there is a href attribute.
I’d expect a:link and a[href] to target the same links except for possibly having a different .precedence. Neither would target <a name="topic">- of course without an id in that tag as well as the name it will not actually do anything in some more modern browsers given that the name attribute on that tag has been obsolete since 1997.
My mistake, it is valid according to the standard but superseded by the id attribute which the standard appears to indicate is the preferred option - which is presumably why some browsers dropped support for name.