Jump to content

Class and id in a single element?


w3schoon

Recommended Posts

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...