Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Feb 2012
    Thanked 0 Times in 0 Posts

    Classes instead of div?


    I ran a page of my site through the w3 Validator, and it mentioned this error:
    "Line 30, Column 10: ID "portfolioitem" already defined"

    I read online that other people with this problem ended up making "classes" instead. Right now I'm using a div called #portfolioitem to float 3 elements in a container. What exactly should I be doing instead? What do I make classes of instead of using #portfolioitem multiple times in my page?

    Thank you in advance.

  2. #2
    Regular Coder Lerura's Avatar
    Join Date
    Aug 2005
    Thanked 132 Times in 131 Posts
    id's must be unique throughout the document. so no two element can have identical id's
    They are used as references to a specific element.

    classes is used if you have 2 or more element that have commons in styling, action on click etc..

    an element can be assigned as many classes as you need, but can only be assigned 1 id.

    In your case you have 6 element with a common(s), so here classes is ideal.
    then you only have to create the css class-rule once, and use it for all element that have that class


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts