PDA

View Full Version : Designing divs


gigiloumill
11-09-2011, 06:32 PM
Guys, this might be a silly question but, does a site need to be designed around a main div such as a "wrapper" or can it be designed on the body itself? Thanks

gentleone
11-09-2011, 07:12 PM
No, it doesn't. The body can act as a wrapper too and I prefer to use it like that when needed. You can give it width, height and a margin: 0 auto to center it. If you want to have a background-image or background-color behind the body tag, you can use the html tag for that in your css.

johnMoss
11-09-2011, 07:15 PM
The main purpose of assigning a container inside the body is to allow for the various screen resolutions. You can put a large image in the container, and when the viewer's browser is bigger than that, which is usually the case, the body background fills in the rest.

gentleone
11-09-2011, 07:34 PM
The main purpose of assigning a container inside the body is to allow for the various screen resolutions.
Kind of... it was more to center content, but why putting an extra div in the mark-up if you can use the body tag for that.

You can put a large image in the container, and when the viewer's browser is bigger than that, which is usually the case, the body background fills in the rest.If you use the body tag as a container then the html background fills the rest ;)

johnMoss
11-09-2011, 07:39 PM
why put an extra div in the mark-up if you can use the body tag for that.

Excellent point. One less chunk of code...

gigiloumill
11-09-2011, 07:40 PM
Ty. Let me get this straight. If wanted to bypass the body tag, all I would need to do is create a wrapper?

gentleone
11-09-2011, 08:20 PM
If wanted to bypass the body tag, all I would need to do is create a wrapper?
Come again, G?

gigiloumill
11-09-2011, 08:28 PM
I was just confused. Can you set a width and height on the body tag?5

domedia
11-09-2011, 08:50 PM
Only use a wrapper div if you think you need one.

There's no point of trying to come up with a reason to use one ;-)

gentleone
11-16-2011, 08:34 AM
I was just confused. Can you set a width and height on the body tag?5
Yes, you can. Personally I do not use heights, but it can. Only 'width' to center things.