@
Kerant;10884093 wrote:
I just wanted to quickly clarify that using div boxes is a good design techinque? In my CSS I am using div class's as opposed to div id's .... is this the right thing to do?
Yes, divs are good to use in design (unless you start getting into very heavily nested divs.. then it starts to get 'ugly' ..aka somewhat comparable to tables.. so yes, divs for design / layout is perfectly fine.
As weedpacket mentioned, ids are for once only items... so say you have a div as such:
<div id="gameImageThumbnail">
There better be only one of those.. in other words, if you declare anything else in your xhtml document to have an id labeled "gameImageThumbnail", this can cause problems (not to mention that your page will not validate in accordance to the W3C validator. I have in the past accidently used mutiple ids with the same name and have the page still 'display properly..' (but fail validation).
Classes on the other hand, can be used over and over again.. so if you have mutiple images that you want to have a specific (and identical) border on for example, then you must use classes (I use 'must' here for proper design practices and validation purposes)..
Incase you are not aware, you can combine classes (say one class for the borders.. and say a class to float: left and another to float:right and use those in combination with your border class, all on some images)
ex:
<img src="whatever" class="imgBorders imgFloatLeft" /> where imgBorders governs the image borders and imgFloatLeft floats the image left.. then conversely, you can make other images float right:
<img src="whatever2" class="imgBorders imgFloatRight" />
To my knowledge, when I tried to mix both ids and classes in the same declaration, it didn't work (in otherwords, it all had to be classes).. but this was for CSS background images sharing the same background.. so perhaps I didn't test this thoroughly..
Point being..both ids and classes have their inherent purposes.. just be sure to validate you code.. you'll find out pretty quickly if you are on the right path or not 😉
Cheers,
NRG