Ok, so I posted this up in this thread (Difference between div id and div class) but was instructed to post it up as an individual question. I get the answers in the previous thread but wanted more clarification on the subject.
I am fairly new to css, so the conversation over DIV and CLASS interests me. I have built a site using wordpress which has allowed multiple ID's. I am interested if there really is anything wrong with this? For example, this code displays four boxes in two columns, two rows within the container...
<div id="container">
<div id="sub_container"
</div>
<div id="sub_container"
</div>
<div id="sub_container"
</div>
<div id="sub_container"
</div>
If I have specific styling that is different to the WP theme, obviously then it can be applied to the div or the class?
So in the case above I might have
#sub_container {background: #ffffff; position: relative; float: left;}
So I want to figure is this OK? If not, what is the benefit of having the sub container as a class rather than a div? I get the 'unique' argument, but if this works fine, why not use it?
In my code I have used classes for some headings and sections where I want specific formatting that varies from the built in formatting, but that's about it..
..I figure I would use class if I wanted to apply different styles to the sub_container div? e.g. might want the second one to have red fonts, or have the boxes a different size on another page etc etc?