Grow your CSS skills. Land your dream job.

[Solved] ID vs Class

  • # October 8, 2009 at 11:39 am

    Hi,

    Excuse my ignorance but I’m confused as when to use the ID and the Class <div> identifier, and I would like to know when it’s appropriate to use either one of these methods and when it is not.

    Can someone please be so kind and explain this a little bit?

    Thank

    # October 8, 2009 at 11:44 am

    An #id is something that will only be used once on a page. Examples:

    #wrapper
    #main-nav
    etc

    You use a class when something could appear more than once, like a photo gallery. Examples:

    .gallery
    .float-left
    etc

    # October 8, 2009 at 2:33 pm

    Got it thank you very much!

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".