Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
Thread: Classes instead of div?
02-28-2012, 04:23 AM #1
- 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.
02-28-2012, 06:04 AM #2
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