CSS - 3 Columns With Header And Footer 100% Height But Not Width?
Hi
i want to have a site with 3 columns a header and a footer where the height of the content and both the columns spreads to fill the page even if there is only a few lines of content. Also i wanted to have a margin round the page so that the page doesnt fill the screen horizontal. i cant seem to get it to work correctly does anyone have an example i can look at? cheers Andy Similar TutorialsHello, im trying to make Fixed width 3 columns (each column have fixed width) layout 100% height with header and footer. -Well I see alot of examples around the web, but i dont see complete one and im really tired of searching, i made the Fixed width 3 comlumns layout, left and right are absolute position, and center is relative to the header -the problem is that all columns dont fill the whole height of the browser windows, the footer doesnot work good. so the whole thing is missed up, so please show 100% working example of what i need. Thanks in Advanced Samer Hello, I'm working now on div layout that contains 3 sections (header, body, footer) in one centered wrapper with border (divs with background imgs). My problem is: - divs that are in fact borders (id="l_outerborder_b" and id="r_outerborder_b") don't stretch when main container (id="body_content_text") grows. Here is a html code: Code: <!--BEGIN TEMPLATE HEADER --> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <link href="template.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="template.js" /> </head> <body onload="onloadprocedures()"> <div id="main_container"> <div id="template_header"> <div id="tl_outerborder"></div> <div id="t_outerborder"></div> <div id="tr_outerborder"></div> <div id="l_outerborder_h"></div> <div id="header_content"> <div id="logo"><img src="img/logo.png" alt="" /></div> <div id="slogan"><img src="img/slogan.png" alt="Centrum zdrowia" /></div> </div> <div id="r_outerborder_h"></div> </div> <!-- END TEMPLATE HEADER --> <!-- BEGIN TEMPLATE BODY --> <div id="template_body"> <div id="l_outerborder_b"></div> <div id="body_content"> <div id="body_content_text"> <p>TEST</p> </div> </div> <div id="r_outerborder_b"></div> </div> <!-- END TEMPLATE BODY --> <!-- BEGIN TEMPLATE FOOTER --> <div id="template_footer"> <div style="clear:both"></div> <div id="l_outerborder_f"></div> <div id="footer_content"></div> <div id="l_outerborder_f"></div> <div id="bl_outerborder"></div> <div id="b_outerborder"></div> <div id="br_outerborder"></div> </div> </div> </body> </html> <!-- END TEMPLATE FOOTER --> and CSS: Code: @charset "utf-8"; /* CSS Document */ body { background-color:#FFFFFF; font-family:Tahoma, Verdana, "Times New Roman", Arial; font-size:12px; } a:link {text-decoration: none} /* unvisited link */ a:visited {text-decoration: none} /* visited link */ a:hover {text-decoration: none} /* mouse over link */ a:active {text-decoration: none} /* selected link */ #main_container { position:relative; margin:auto; width:960px; height:auto; } #template_header { float:left; position:relative; width:960px; height:300px; } #header_content { float:left; position:relative; width:900px; height:270px; } #logo { width:310px; height:130px; position:relative; float:left; top:0px; left:0px; } #slogan { width:580px; height:100px; position:relative; float:left; top:0px; left:0px; } #tl_outerborder { float:left; position:relative; background-image:url(img/tl_outerborder.png); width:30px; height:30px; } #t_outerborder { float:left; position:relative; background-image:url(img/t_outerborder.png); width:900px; height:30px; } #tr_outerborder { float:left; position:relative; background-image:url(img/tr_outerborder.png); width:30px; height:30px; } #l_outerborder_h { float:left; position:relative; background-image:url(img/l_outerborder.png); background-repeat:repeat-y; width:30px; height:270px; } #r_outerborder_h { float:right; position:relative; background-image:url(img/r_outerborder.png); background-repeat:repeat-y; width:30px; height:270px; } #body_content { float:left; position:relative; width:900px; overflow:hidden; } #body_content_text { float:left; position:relative; width:600px; margin: auto; overflow:hidden; } #l_outerborder_b { float:left; position:relative; background-image:url(img/l_outerborder.png); background-repeat:repeat-y; width:30px; height:inherit; } #r_outerborder_b { float:right; position:relative; background-image:url(img/r_outerborder.png); background-repeat:repeat-y; width:30px; height:inherit; } #l_outerborder_f { float:left; position:relative; background-image:url(img/l_outerborder.png); background-repeat:repeat-y; width:30px; height:inherit; } #r_outerborder_f { float:right; position:relative; background-image:url(img/r_outerborder.png); background-repeat:repeat-y; width:30px; height:inherit; } #template_body { float:left; position:relative; width:960px; overflow:hidden; } #bl_outerborder { float:left; position:relative; background-image:url(img/bl_outerborder.png); width:30px; height:30px; } #b_outerborder { float:left; position:relative; background-image:url(img/b_outerborder.png); width:900px; height:30px; } #br_outerborder { float:left; position:relative; background-image:url(img/br_outerborder.png); width:30px; height:30px; } Thanks in advance for info how to stretch those doomed divs EDIT: Here is layout concept. URL hTTp://qsrc.pl/layout.jpg I have found many different ways of doing the 3 column fluid layout on the net... http://css-discuss.incutio.com/?page=ThreeColumnLayouts But none of theme seem simple enough to implement 3 fluid columns where each column is a percentage. I have found a couple, but modifying the css to find my percentage needs loses the effect often times because the css code is long and complicated with many embeded divs. Isnt there an easy way to have a header at top, 3 columns (20%,60%,20% widths) each stretching the same height and a footer at the end? I thought that floating would work, but i get mixed and undesired output in IE and FF. Thanks to all that contribute. You can see an example on http://www.cauwenbergh.be/dzone/ The yellow div does not fill between header and footer when there is not enough text in it :s So is there any way to get it filled between header and footer... html: Code: <div id="wrap"> <div id="header"> <div id="balk"> <div id="balk_midden">...</div> </div> <div id="header_wrap"> <img src="images/header.gif" alt="Dutchzone voor al uw internettoepassingen: Webhosting - webdesign - netwerken"/> </div> <div id="balk"> <div id="balk_midden">...</div> </div> </div> <div id="inner-wrap"> <div id="pagebox">Hier komt tekst</div> </div> <div id="footer"> <div id="copyright">Footer</div> </div> </div> css: Code: body, html { height:100%; } body { margin:0; padding:0; background-image:url(../images/bg34.gif); font-family: "trebuchet ms", verdana, helvetica, sans-serif; font-size: 14px; } #wrap { position:relative; width:100%; margin:auto; min-height:100%; } * html #wrap { height:100%; } #inner-wrap { padding-bottom:20px; } #inner-wrap:after { content:" "; display:block; clear:both; background-color:#00FF33; } * html #inner-wrap { height:1px; } #header_wrap { background:#333333 url(../images/dzheader_back.gif); color:#FF00FF; margin:0; padding:0; height:120px; text-align: center; } #balk { padding: 0px; width: 100%; background-color:#7999B9; border-bottom: 1px solid #F7F7F9; border-top: 1px solid #F7F7F9; height: 20px; } #balk_midden { width: 800px; margin-left: auto; margin-right: auto; background-color:#7999B9; border-right: 1px solid #FFFFFF; border-left: 1px solid #FFFFFF; color: #FFFFFF; line-height: 20px; text-align: right; } #header { background-image:url(../images/dzheader_back.gif); margin: 0px; margin-left: auto; margin-right: auto; padding: 0px; } #header img { text-align:center; border-left: 1px solid #FFFFFF; border-right: 1px solid #FFFFFF; margin:0; margin-bottom: -4px; padding-left: 30px; padding-right: 30px; } #pagebox { width: 800px; margin: auto; background-color:#FFFF00; border-left: 1px solid #807E7A; border-right: 1px solid #807E7A; height: 300px; } #footer { position:absolute; bottom:0; width:100%; height:20px; background-color:#7999B9; } #copyright { padding: 0px; width: 800px; text-align: center; background-color:#7999B9; border-left: 1px solid #FFFFFF; border-right: 1px solid #FFFFFF; vertical-align: bottom; margin: 0 auto 0 auto; color: #FFFFFF; bottom: 0; height: 20px; } Hi, I have a multi-column layout where I want every column to always be the same height. Any one of the columns may be the longest on any given page, so the other columns have to automatically adjust to match that height. Usually I'd just use the faux column technique where you repeat a background image, but that won't work because of two elements on this page: 1. each column has a border all the way around it. 2. one column resizes with the page. I've read the articles on liquid layouts with faux columns, but as far as I can tell those techniques won't work if your columns have borders. Does anyone know any technique that would work here? Thanks. I want to do this design: http://hermann.sonyextreme.com/upload/design.png * means it should be "the rest". Just like when working with frames. So the sites height is 100% and width is 800px. I've set it up like this: Code: <div id="container"> <div id="header"> </div> <div id="main"> <div id="menu"> </div> <div id="content"> </div> </div> <div id="footer"> </div> </div> But no matter what I try, the css just keeps ****ing with me So do you have any tricks/know any sites who have done this succesfully... or just anything to help me, then I'd love to hear from you Thanks in advance Hermann Trying to delete my post but no option to delete so just removing content. Hi Guys, Consider the following box: PHP Code: <div style=border: 1mm black Solid; width: 148mm; height: 98mm;'> </div> 148mm + 1mm + 1mm = width of 150mm 98mm + 1mm + 1mm = width of 100mm Now why does neither firefox or ie manage to get it? Firefox is about 2mm out and ie is about 3mm out? Any ideas or is it some quirk? Charlie I have seen a design which I find pretty interesting where in the main site is aligned left and fixed width at say 700px wide. Yet the footer seems to span the entire screen. The header also seems to use the entire screen width but that is beign accomplished with the background image, but this footer goes all the way to end of the screen and naturally adjusts itself under all the content. Is there a way to get this effect? Hi, I have hit the "wall" in my knowledge of CSS while trying to implement a "flex-width-equal-height-sidebar-layout" style of layout as a skin/theme for a message board system and need some help. My trouble occurs when a direct link to the post is used (instead of following the menu navigation system) where the top menu information/links area (the area between the banner and the post) is chopped off... The relevant portion of the CSS seems to be the .col_wrap {margin-top: 10px; border: 0; overflow: hidden; float: left; width: 100%; position: relative; z-index: 10; clear: both;} portion of my CSS because if I take out the overflow:hidden declaration then the menu portion of the skin/theme/layout shows correctly but the sidebar the shows the part which should be hidden at the bottom and the footer completely vanishes from view! My apologies but this is the best I can do without having the ability to post pics or urls which could better explain what is wrong and frankly speaking I don't know how anyone here can help given my inability to show the problem but hopefully someone knows or has run into this problem before or can offer some resources that may be of assistance.... I'm trying to redo my layout so it will load fast for my users and the way I am doing it is with divs. Anyways I have it finished but I've run into a problem; my columns are all different widths. I want them to all meet at the footer. To see what I mean take a look. http://www.rpgchateau.com/rpgapex/test/test/index.html The css is url is... http://www.rpgchateau.com/rpgapex/test/test/test.css I would rather not replace them with an image to get them to repeat, is there any other way I can do it? I have stumbled onto two issues with my layout. I have a fixed footer and I have my three columns and the problem I am having is that the content hides behind the fixed footer which is what I want. However when the content is just not enough it gets clipped behind the footer and what I'd like is to have i scroll up to the top of the footer in that situation. How would I do that in my css? The second issue is that when I have a lot of content it breaks out of the container div or at least it appears that way. I'd like it to push the columns down inside the container as needed. The css and xhtml arevalid. Here is the link: http://www.lonniebruhn.com/sitelab/ Thanks for your help LB Hi. I have a page with 3 absolutely positioned columns. I want the footer to set right underneath the main content. Currently I have a container for the main content and a footer <div> that sits outside of this container. However, certain browsers (NN7 & IE6) are pushing the footer down too far. Anyone know how I can control this? Here's my css: #container{ position:relative; height:100%; width:780px; } #footer { position: relative; top: 0px; left: 0px; clear:both; } Is it possible to to set up two divisions that display next to each other and take up the entire width of page? Neither of the divisions would be static. In my example, the one division would contain an image of variable size and the second division would take up the remainder of the width of the page with text. Is this possible with CSS? I can make this work with tables, but haven't been able to manage it with CSS. Any help would be greatly appreciated. Thank you. Anne. hi, I have 2columns with varying heights. and then I have a div below which spans the width of both. If the right column is taller than the left there is no problem. The underneath div falls under it by 5px. But when the left columns is taller than the right. The column underneath still falls 5px below the right column, but the div below is underneath the left column. anyone know how to get the div below to go 5px below whichever div is tallest? heres the css: PHP Code: #leftColumn { float: left; margin: 10px;; width: 300px; padding: 0; } #register { margin: 20px 0 10px 330px; border: 1px solid #ccc; width: 396px; background: #fff; } #prodBreak { margin: 0 10px; padding: 0; border-top: dashed #666 1px; border-right: solid #ccc 1px; border-bottom: none; border-left: solid #ccc 1px; background: #fff url(../images/break.gif) repeat-x; width: 720px; height: 50px; } ta, if you dont understand the explanation please let me know and ill draw a picture Doh! Nevermind, I fixed my problem. Hey I am creating a website in php with a header and footer attached as in: <?php include("header.php"); ?> I have set the minimum height of the page to 600px however in IE it doesnt' work it displays half up the page In Firefox it is fine but in IE it doesn;t work any clues? cheers J Hello. I'm presently writing a JavaScript applet which will be included into websites to produce a dynamically created header and footer through PHP. That's not important for the most part. What I would like to do is create the header and footer through CSS. I do, howver, have a slight problem. I can not have the user edit their websites in any way except for adding the script inclusion. (<script language="javascript" src="http://webaddress/script.js">) Now, this is what I've come up with for the CSS. css Code: Original - css Code body { padding: 25px 0 25px 0; } .ixga_header { position: fixed; font-size: 11px; font-family: /*Arial, */Verdana, Helvetica, sans-serif; color: #EAEAEA; top: 0; left: 0; } .ixga_header table,tr,td { font-size: 11px; font-family: /*Arial, */Verdana, Helvetica, sans-serif; color: #FFFFFF; } .ixga_header a, a:visited { font-size: 11px; font-family: /*Arial, */Verdana, Helvetica, sans-serif; color: #EAEAEA; } .ixga_header a:hover { font-size: 11px; font-family: /*Arial, */Verdana, Helvetica, sans-serif; color: #EAEAEA; } /* hide from mac ie5 \*/ .ixga_header { position: absolute; } /* end hide from mac ie5 */ html>body .ixga_header { position: fixed; } .ixga_footer { position: fixed; font-size: 11px; font-family: Verdana, Helvetica, sans-serif; color: #EAEAEA; bottom: 0; left: 0; } .ixga_footer table,tr,td { font-size: 11px; font-family: Verdana, Helvetica, sans-serif; color: #FFFFFF; } .ixga_footer a, a:visited { font-size: 11px; font-family: Verdana, Helvetica, sans-serif; color: #EAEAEA; } body { Does this seem right to you? Now, the HTML injected by the remote script is as follows. html Code: Original - html Code <div class="ixga_header"> <link href="http://localhost/header/header.css" rel="stylesheet" type="text/css" media="all" /> <table width="100%" height="25" border="0" cellpadding="0" cellspacing="0"> <tr height="25" style="background-image:url(\'http://localhost/header/images/bg.gif\')"> <td align="left"> <b> <a href="http://gaming.localhost"> Gaming Network </a> </b> - <a href="http://ds.localhost"> Demonic Sights: The Adventure Begins </a> - <a href="http://ds2.localhost"> Demonic Sights: The War of Aegis </a> - <a href="http://ta.localhost"> Total Apocalypse </a> </td> <td align="right"> <a href="http://localhost/login.php">Login</a> | <a href="http://localhost/register.php">Register</a> </td> </tr> </table> </div> <div class="ixga_footer"> <table width="100%" height="25" border="0" cellpadding="0" cellspacing="0"> <tr height="25" style="background-image:url('http://localhost/header/images/bg.gif')"> <td align="left"> This is a test footer. Woo. </td> </tr> </table> </div> <div class="ixga_header"> <link href="http://localhost/header/header.css" rel="stylesheet" type="text/css" media="all" /> <table width="100%" height="25" border="0" cellpadding="0" cellspacing="0"> <tr height="25" style="background-image:url(\'http://localhost/header/images/bg.gif\')"> <td align="left"> <b> <a href="http://gaming.localhost"> Gaming Network </a> </b> - <a href="http://ds.localhost"> Demonic Sights: The Adventure Begins </a> - <a href="http://ds2.localhost"> Demonic Sights: The War of Aegis </a> - <a href="http://ta.localhost"> Total Apocalypse </a> </td> <td align="right"> <a href="http://localhost/login.php">Login</a> | <a href="http://localhost/register.php">Register</a> </td> </tr> </table> </div> <div class="ixga_footer"> <table width="100%" height="25" border="0" cellpadding="0" cellspacing="0"> <tr height="25" style="background-image:url('http://localhost/header/images/bg.gif')"> <td align="left"> This is a test footer. Woo. </td> </tr> </table> </div> The problem I face is that any HTML on the original page somehow gets shoved UNDER the footer, no matter the case, as if it just shoves the data that SHOULD be there into the footer division itself. Can someone please suggest a better method I can take of doing this? Or perhaps point me to a resource where I can see how to dynamically add a header and footer to a webpage through CSS _WITHOUT_ having to include a division for the page contents itself? This needs to work out of the box. Thanks in advance. I'm currently using .php to include a common header and footer. Is there a way to use CSS to include a common footer. Not the style, but the text themselves. |