BentCoder
BentCoder

Reputation: 12740

Footer won't appear at all

I cant get footer to appear at all. I know that there is something small I'm missing out but what is it?

I played with positioning and display options but still no luck.

JS FIDDLE HERE

CSS:

*
{
    margin: 0;
    padding: 0;
}
body, html
{
    font-family: 'Cuprum', sans-serif;
    font-size: 14px;
    font-weight: normal;
    color: #333333;
}
.block 
{
    display: block;
    width: 100%;
}
.header
{
    position: fixed;
    top: 0px;
    z-index: 10;
    height: 50px;
    background-color: #f0a108;
}
.carousel
{
    position: fixed;
    top: 50px;
    height: 400px;
    background-color: #AADD66;
}
#carousel
{
    margin: 0 auto;
    width: 900px;
    height: 400px;
    background-color: #BABABA;
}
.menu
{
    position: absolute;
    top: 450px;
    z-index: 9;
    height: 40px;
    background-color: #CC11AA;
}
#menu
{
    margin: 0 auto;
    width: 900px;
    height: 40px;
    background-color: #1CCACA;
}
.fixed
{
    position: fixed;
    top: 50px;
}
.body
{
    position: absolute;
    top: 490px;
    background-color: #08a1f0;
}
#body
{
    margin: 0 auto;
    width: 900px;
    background-color: #BAC555;
}
.footer
{
    background-color: #19DE55;
}
#footer
{
    margin: 0 auto;
    width: 900px;
    background-color: #08f018;
}

HTML:

<div class="block header">
        <div id="header">HEADER</div>
    </div>

    <div class="block carousel">
        <div id="carousel">CAROUSEL</div>
    </div>

    <div class="block menu">
        <div id="menu">MENU</div>
    </div>

    <div class="block body">
        <div id="body">
            BEGIN
            <br />
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />Body
            <br />
            <br />END
        </div>
    </div>

    <div class="block footer">
        <div id="footer">
            FOOTER
        </div>
    </div>

JQUERY:

$(document).ready(function ()
{
    $(window).on("scroll", function (e)
    {
        if (! $('.block.menu').hasClass('fixed'))
        {
            if ($(document).scrollTop() >= 400)
            {
                $('.block.menu').addClass('fixed');
            }
        }
        else
        {
            if ($(document).scrollTop() < 400)
            {
                $('.block.menu').removeClass('fixed');
            }
        }
    });
});

Upvotes: 0

Views: 63

Answers (3)

Manoj
Manoj

Reputation: 1890

All the content div is positioned with a fixed or a absolute,but footer is not positioned that's why is not appearing

Try this code:

DEMO

.footer
{
    background-color: #19DE55;
    position: fixed;
    bottom: 0;
}

Upvotes: 0

Manuszep
Manuszep

Reputation: 823

As your body is absolutely positionned, the footer sits right under the header, behind the carrousel.

You could wrap the body and footer and set the position: absolute on the wrapper to keep them grouped.

Upvotes: 2

brutusmaximus86
brutusmaximus86

Reputation: 264

Because all other content is positioned with a fixed or a absolute, you're footer is at the top underneath the header and menu.

Upvotes: 1

Related Questions