Is there anything wrong with having a css class and id with the same name? Like .footer for the article/post’s footer and #footer for the page footer.
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.
Nope, perfectly acceptable.
A class is defined using a
.and an ID is defined using a#. So as far as the browser is concerned, they’re two totally separate items.The only thing to be careful of is generating any confusion for yourself. It’s probably best practise to keep the names different purely for code readability, but there’s no harm in them being the same.