-1

Hi i'm doing the a basic layout and i have a problem with my css. I have a footer tag set, but it doesnt appear at the bottom it appears a the midway point in the page.

Here is my CSS code

My "footer" doesn't appear at the foot if the page ?

I think it might be the height and width i have set but i'm not sure what to set it as prperly.

Thanks in advance

body
{
background: url("http://ulyssesonline.com/wp-content/uploads/2011/12/darkwood.jpg");
height: 100%;
width: 100%;
}


#social {
float: right;
background-color:black;
}

#social1 {
float:right;
background-color:black;
}

#wrapper,#header,#main,#footer
{
width:100%;
}
#wrapper
{
width:960px;
height:720px;
margin:0 auto;
}

#header
{

height:100px;
background:#000;
}

#main
{

height:750px;
background:#666;
}


#footer
{
margin-bottom:-50px; 
height:50px; 
background-color:red;}
} 

3 Answers3

4

Replace the footer with:

#footer
{  position:absolute;
   bottom:0;
   width:100%;
   height:50px;   /* Height of the footer */
   background:#6cf;
background-color:red;}

The tutorial used: http://matthewjamestaylor.com/blog/keeping-footers-at-the-bottom-of-the-page

This is my full CSS:

body
{
background: url("http://ulyssesonline.com/wp-content/uploads/2011/12/darkwood.jpg");
height: 100%;
width: 100%;
}


#social {
float: right;
background-color:black;
}

#social1 {
float:right;
background-color:black;
}

#wrapper,#header,#main,#footer
{
width:100%;
}
#wrapper
{
width:960px;
height:720px;
margin:0 auto;
}

#header
{

height:100px;
background:#000;
}

#main
{

height:750px;
background:#666;
}

And this is how i referenced it from the html:

<footer  id ="footer">Some footer text</footer>

I suspect you did not reference it correctly, with the proper id from your div?

SummerCode
  • 1,403
  • 1
  • 14
  • 28
1

I think I see your problem. In the footer css code you have the following:

#footer
{
margin-bottom:-50px; 
height:50px; 
background-color:red;}
} 

Pretty sure the margin-bottom being a negative number is the issue. Change that to 5 or 10 and see if it appears.

Jason Rybka
  • 157
  • 2
  • 15
0

i got it thanks for all your help.

i got this from summer codes answer above

#footer
{  position:absolute;
bottom:0;
width:100%;
height:50px;   /* Height of the footer */
background:#6cf;
background-color:red;}

and i had to change the main section to

#main
{
position:relative;
height:100%;
background:#666;
}