rv20 Posted May 27, 2009 Share Posted May 27, 2009 Do you really need a container div around all your code, i see this in most source but then i can create a div layout without it so what are the pluses to having one? Quote Link to comment https://forums.phpfreaks.com/topic/159896-main-div-container-or-not/ Share on other sites More sharing options...
Axeia Posted May 27, 2009 Share Posted May 27, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/159896-main-div-container-or-not/#findComment-843388 Share on other sites More sharing options...
Goafer Posted May 28, 2009 Share Posted May 28, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/159896-main-div-container-or-not/#findComment-844068 Share on other sites More sharing options...
TheFilmGod Posted May 28, 2009 Share Posted May 28, 2009 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). Quote Link to comment https://forums.phpfreaks.com/topic/159896-main-div-container-or-not/#findComment-844185 Share on other sites More sharing options...
haku Posted May 29, 2009 Share Posted May 29, 2009 I generally don't use one, and add one if necessary later on. Quote Link to comment https://forums.phpfreaks.com/topic/159896-main-div-container-or-not/#findComment-844722 Share on other sites More sharing options...
SuperBlue Posted May 30, 2009 Share Posted May 30, 2009 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. Quote Link to comment https://forums.phpfreaks.com/topic/159896-main-div-container-or-not/#findComment-845843 Share on other sites More sharing options...
papillonstudios Posted June 3, 2009 Share Posted June 3, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/159896-main-div-container-or-not/#findComment-848292 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.