Jump to content

Main div container or not?


rv20

Recommended Posts

You can't directly put text in the <body> if you want to have a validating page so that's one, but usuallly it's for some kind of background image and/or color, or to center something.

It isn't required.. but try creating a page without one, I've thought I wouldn't need one sometimes when I started on converting a design to html.. but then ended up having one in the end.

Link to comment
Share on other sites

As mentioned above, I always find I end up with one,re-gardeless of whether I start with it or not.

They are useful for styling, and even if you decide not to really make anything of it, there's no harm leaving it in.

Link to comment
Share on other sites

using a container div is far more easier than styling each section separately. Moreover, in CSS 2.0 you can't have multiple backgrounds, which means that more often than now, you put some background into the container div to achieve the same effect you could do with multiple bgs (CSS 3.0).

 

Here is an excerpt on why a container div is helpful:

 

<!-- Html Page Div -->
<div id="html_page">

<!-- Header -->

<?php
// Require Header
require ($element. 'header.php');

?>

<!-- Body -->

<div id="body"...

 

As you can see, the container div helps establish a general framework (especially with php includes).

Link to comment
Share on other sites

You don't really need one, but sometimes its preferred for design reasons. Espicually when dealing with centered multi-column layouts.

 

Its also far easier to simply apply a min/max width on the container, then it is to calculate the widths of each column. I usually only use percentages for the columns, and then reserve the absolute units to the Basement division of the page.

Link to comment
Share on other sites

well for me i use a div called container hold all my different content like navbar, sidebar, content etc.

 

So heres how i organized my cms i'm making

 

<html>
<head>
    <title>Site Title</title>
</head>
<body>
    <div class="c1">
        <div class="logo">
        <center>
            Logo Here
            </center>
        </div>

        <div class="nav">
            Top Navbar Here
        </div>

        <div class="Container">
            <div class="content">
               Content Here
            </div>

            <div class="sidebar">
                Sidebar here
            </div>
        </div>

        <div class="footer">
            footer here
        </div>
    </div>
</body>
</html>

 

That put the logo at the top in the middle with the navbar below it and the content below that and the sidebar on right with the footer below everything.

 

So ya i would use it

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.