w3schoon Posted February 5, 2013 Share Posted February 5, 2013 Nice to be with you everyone! Problem: Is it good practice to used class and id in a single element? Example: <p id="a" class="b"> Correct me <p> Thank you. Link to comment Share on other sites More sharing options...
jeffman Posted February 5, 2013 Share Posted February 5, 2013 It is not automatically bad practice, and good developers do it frequently. That said, it's possible to make a mess out of anything. From a strictly CSS point of view, this technique is useful if multiple elements need the same style (create a class) and a single member of that class needs to modify 1-2 aspects of that style (use the ID). Link to comment Share on other sites More sharing options...
callumacrae Posted February 6, 2013 Share Posted February 6, 2013 That's not a problem at all, most developers do it on a fairly regular basis. If you specifically aim to not use IDs and classes on the same elements, you will end up with either some very messy CSS, or some really messy HTML. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now