Need some help with CSS (footer at bottom an two full height columns)
Posted: 22 October 2008 05:50 PM   [ Ignore ]
Newbie
Rank
Total Posts:  3
Joined  2008-10-22

I hope some of you can help me.

I need the following lay-out:
- a header (at the top of course)
- a footer that stay at the bottom when the content is smaller than the browser window
- two columns (full height beacuse of background colours in the navigation) in the body div, one for navigation and one for content.
- and it has to be IE (6/7) and Firefox compatible

I have the part where the footer stays at the bottom in Firefox and IE, but I am at loss how to add the two columns next to each other and get the to full height of the window.

This my code:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<
html>
<
head>
<
title>Volledig scherm gebruiken</title>
<
style media="screen" type="text/css">
 
html,
 
body {
  margin
:0;
  
padding:0;
  
height:100%;
 
}
 
#container {
  
min-height:100%;
  
position:relative;
 
}
 
#header {
  
background:#ff0;
  
padding:10px;
 
}
 
#body {
  
padding:10px;
  
padding-bottom:60px
 
}
 
#footer {
  
position:absolute;
  
bottom:0;
  
width:100%;
  
height:60px;   
  
background:#6cf;
 
}
 
 
#navigation 
 
{
     
/* ????? */
 
}
 
 
#content
 
{
     
/* ????? */
 
}
 
 
</style>
 <!--
[if lt IE 7]>
 <
style media="screen" type="text/css">
 
#container {
  
height:100%;
 
}
 
</style>
 <!
[endif]-->
</
head>
 
<
body>
    <
div id="container">
       <
div id="header" >
            
Header
        
</div>
 
        <
div id="body">
            <
div id="navigation">        
                
Navigation
            
</div>        
            <
div id="content">
                
Content
         
</div>
        </
div>
        
        <
div id="footer">
            
footer
        
</div>
    </
div>
    </
form>
     
</
body>
</
html

I am looking for a solution without any javascript.

I hope you can help me.

Thx a lot !!

Profile
 
 
Posted: 22 October 2008 07:54 PM   [ Ignore ]   [ # 1 ]
Newbie
Rank
Total Posts:  17
Joined  2008-10-19

well, i can point you in the direction of a template (css) that I have used quite often.

<!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" lang="en" xml:lang="en">
<
head>
<
meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<
title>Dynamic DriveCSS Fixed Layout #3.1- (Fixed-Fixed-Fixed)</title>
<style type="text/css">

body{
margin
:0;
padding:0;
line-height1.5em;
}

b{font
-size110%;}
em{color
red;}

#maincontainer{
width840px/*Width of main container*/
margin0 auto/*Center container on page*/
}

#topsection{
background#EAEAEA;
height90px/*Height of top section*/
}

#topsection h1{
margin0;
padding-top15px;
}

#contentwrapper{
floatleft;
width100%;
}

#contentcolumn{
margin0 190px 0 180px/*Margins for content column. Should be "0 RightColumnWidth 0 LeftColumnWidth*/
}

#leftcolumn{
floatleft;
width180px/*Width of left column in pixel*/
margin-left: -840px/*Set margin to that of -(MainContainerWidth)*/
background#C8FC98;
}

#rightcolumn{
floatleft;
width190px/*Width of right column*/
margin-left: -190px/*Set left margin to -(RightColumnWidth)*/
background#FDE95E;
}

#footer{
clearleft;
width100%;
backgroundblack;
color#FFF;
text-aligncenter;
padding4px 0;
}

#footer a{
color#FFFF80;
}

.innertube{
margin
10px/*Margins for inner DIV inside each column (to provide padding)*/
margin-top0;
}

</style>


/*** Temporary text filler function. Remove when deploying template. ***/
var gibberish=["This is just some filler text""Welcome to Dynamic Drive CSS Library""Demo content nothing to read here"]
function filltext(words){
for (var i=0i<wordsi++)
[removed](gibberish[Math.floor(Math.random()*3)]+" ")
}


</head>
<
body>
<
div id="maincontainer">

<
div id="topsection"><div class="innertube"><h1>CSS Fixed Layout #3.1- (Fixed-Fixed-Fixed)</h1></div></div>

<div id="contentwrapper">
<
div id="contentcolumn">
<
div class="innertube"><b>Content Column: <em>Fixed</em></bfilltext(10)</div>
</
div>
</
div>

<
div id="leftcolumn">
<
div class="innertube"><b>Left Column: <em>180px</em></bfilltext(20)</div>

</
div>

<
div id="rightcolumn">
<
div class="innertube"><b>Right Column: <em>190px</em></bfilltext(15)</div>
</
div>

<
div id="footer"><a href="http://www.dynamicdrive.com/style/">Dynamic Drive CSS Library</a></div>

</
div>
</
body>
</
html

This template can be found here: http://www.dynamicdrive.com/style/layouts/item/css-fixed-layout-31-fixed-fixed-fixed/

Profile
 
 
Posted: 27 October 2008 03:06 PM   [ Ignore ]   [ # 2 ]
Newbie
Rank
Total Posts:  2
Joined  2008-10-27

Expanding two divs to the height of the browser window is often tricky since a container will only expand as much as it’s needed. I’d recommend using the faux columns trick, which is essentially just vertically tiling a background image to mimic the two columns and positioning your two divs over the top.

Hope that helps!

Profile