Search code examples
htmlcsssticky-footer

Sticky footer doesn't work if the the screen height is too small


Hate to bring another sticky footer question but after hours of looking for answers over the course of two days I give up.

Here's my the page in question: http://aaronisdead.com/sites/kanwakan/kanwakan.html

Here's my HTML architecture

<html>
 <head>
</head>
<body>
<header>
<div class="headercenter"><img src="kanwakanheader.png"></div>
     </header>

    <div class="mainwrap">
            <div class="left">
                <img src="featonspin.png">
                <iframe src="https://player.vimeo.com/video/78659516" width="464" height="257" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
            </div>
            <div class="right">
                <img src="featoncarson.png">
                <iframe src="https://player.vimeo.com/video/86751056" width="464" height="257" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
            </div>
            <div class="bandpic">
                <img src="bandpic.jpg">
            </div>
            <div class="text">
</div>
    </div>
    <div class="wrapper">
        <div class="push"></div>
    </div>

<div class="footer">
    <div id="footwrap">
        <div id="leftcol">
            <img id="email" src="bottomcontact.png">
        </div>
        <div id="rightcol">
            <img id="andlogo" src="bottomlogos.png">
        </div>
    </div>
</div>

Annnd here's my CSS.

.mainwrap {
margin-right:auto;
margin-left:auto;
display:block;
width:950px;
top:75px;
height:100%;
}

.right {
position:relative;
width:50%;
margin-right:auto;
margin-left:auto;
display:block;
float:right;
padding:0 0 30 0;
}

.left {
position:relative;
padding-bottom:0px;
width:50%;
margin-right:auto;
margin-left:auto;
display:block;
float:right;
left:10px;
}

/*HEADER*/

.headercenter {
width:375px;
margin-right:auto;
margin-left:auto;
display:block;
}

header {
position:relative;
width:100%;
height:75px;
background:#000000;
}

/*FOOTER STUFF*/

#email, #andlogo {
height:75px;
}

#footwrap {
width:950px;
height:75px;
margin-right:auto;
margin-left:auto;
display:block;
}

#leftcol {
float:left;
width:50%;
}

#rightcol {
float:right;
width:50%;
}

/*ABSOLUTELY NECESSARY PAGE PROPERTIES*/

body {
background-image:url("background.jpg");
background-attachment: fixed;
background-height:100%;
background-repeat:repeat;
background-position:center;
}

* {
margin: 0;
}

html, body {
height: 100%;
}

.wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -75px;
}

.footer {
width:100%:
position:absolute;
background:#000000;
z-index:999;
}

.footer, .push {
height: 75px;
}

I'm not sure what's causing this; I've included a lot of information because of this. If you're taking the time pour through all this you would be helping me in a very big way in understanding sticky footers, a skill I'll be able to use as a web developer forever. Thank you.


Solution

  • Remove height: 100% from .mainwrap and move it inside the .wrapper.