tags:

views:

58

answers:

2

Hi there.

This is the first time i am properly coding in HTML,CSS. in my code i have used whole lot of div's to position and also to put the content in place. i am not sure if i am coding the right way. i have loads of contents too in a single page. here is the link to my code i have used.

http://jsfiddle.net/32ShZ/

can you please suggest. is it really bad in structure and shape?

+4  A: 

Absolutely not. You don't want to go overboard though (it's called "div soup" when you do). If you find that a div has no purpose but to hold a background image, or to clear a float, etc that means you've done something wrong. By using wrappers (e.g. 3 levels deep of div tags for a content area that has some backgrounds, etc is OK), you can properly achieve any layout that you need without resorting to "div soup". Take a look at http://www.digitalperfections.net/ for an example of good (x)HTML with a lot of div tags.

To further expand, and answer the question about your code specifically, I noticed one thing right off the bat: <div id="divider"></div> - this is bad because you're using this div purely for non-semantic purposes (for decoration only).

orokusaki
correct and true. i should get rid of it somehow. ill work on it.
Ibrahim Azhar Armar
@Ibrahim - you might also consider using `<!-- CLOSE: .some_div_class -->` style comments at the end of each div to indicate what div it is (easier to debug stuff later).
orokusaki
thank you for the suggestion. i will consider using it right away.
Ibrahim Azhar Armar
It's actually called "divitis" :-)
Andrew Vit
@Andrew - divitis usually has a distinct rash to go along with it. There's talk of it going airborne soon.
orokusaki
+1  A: 

The general principle is use as less HTML for layout as possible. And try to give Style to your page with the help of CSS. So if a minimum number of divs can achieve your task, you should go for it. This helps to make page lighter and maintainable. But yes how small structure (HTML) you can have in your page depends on your experience and design.

sushil bharwani