Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS [Solved] what's difference between these selectors ? Reply To: what's difference between these selectors ?

#153683
Paulie_D
Member

#selector or .selector will usually be enough.

There should never be a need for tagName#selector (eg. div#header) because the # is an ID and should be unique on the page.

You might occasionally see div.selector but this usually only where the class is quite general and could be applied to multiple element types.

So div.selector would apply only to divs with that class but .selector would apply to ANY element with that class whether is was a div or not.