Some CSS selectors have # in front of them, what does that mean?
Some CSS selectors have # in front of them, what does that mean?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
It’s the ID selector, a fundamental feature of the CSS standard. It matches the HTML element with the given ID, according to the
idattribute (assuming a conforming document, of course). See the W3C Selectors spec for more.You may also have seen the
#notation used in a URL fragment identifier to refer to named anchors (<a name="some-anchor"></a>). These can also point to elements with certain IDs in your page, just like named anchors, and I gather that it’s why CSS uses the same notation for selecting IDs.