Alex Klinghoffer
Alex Klinghoffer

Reputation: 369

How do I keep my background image at the bottom of the page?

this is my website: http://www.alexklinghoffer.com/

How do I keep the background image at the bottom? If you make the browser window smaller, with image drifts towards the top, but I want to keep it in the bottom right hand corner. This is my code:

HTML:

<body>

<div class="logo">
    <a href="http://www.alexklinghoffer.com"><img id="logo" src="images/aklogowhite.png" alt="Alex Klinghoffer Logo"/></a>
</div>

<div id="dock">
    <ul>
        <li><a href="/index.html"><span>&#160;Home&#160;</span><img src="images/home.png" alt="[photo]" /></a></li><!--
        --><li><a href="/bio.html"><span>&#160;Bio&#160;</span><img src="images/bio.png" alt="[photo]" /></a></li><!--
        --><li><a href="/resume.html"><span>&#160;Resume&#160;</span><img src="images/resume.png" alt="[photo]" /></a></li><!--
        --><li class="active"><a href="/collections.html"><span>&#160;Collections&#160;</span><img src="images/collections.png" alt="[photo]" /></a></li><!--
        --><li class="active"><a href="/references.html"><span>&#160;References&#160;</span><img src="images/references.png" alt="[photo]" /></a></li><!--
        --><li><a href="/contact.html"><span>&#160;Contact&#160;</span><img src="images/email.png" alt="[photo]" /></a></li><!--
        --><li><a href="/blog.html"><span>&#160;Blog&#160;</span><img src="images/blog.png" alt="[photo]" /></a></li><!--
        --><li><a href="http://www.facebook.com/alexklinghoffer"><span>&#160;Facebook&#160;</span><img src="images/facebook.png" alt="[photo]" /></a></li><!--
        --><li><a href="http://www.linkedin.com/in/alexklinghoffer"><span>&#160;LinkedIn&#160;</span><img src="images/linkedin.png" alt="[photo]" /></a></li>
    </ul>
</div>

<div id="content">

</div>

<div id="footer">
    <p>&copy; 2013 <a href="http://www.alexklinghoffer.com">Alex Klinghoffer</a></p>
</div><!--//footer-->

</body>
</html>

CSS

body {
    background: url("images/background.png");
    background-size: cover;
    background-repeat: no-repeat;
    background-color: #111111;
    padding: 0;
    margin: 0;
}

Thanks in advance!

Upvotes: 1

Views: 15802

Answers (5)

Aleksandar
Aleksandar

Reputation: 4146

Just use basic CSS code..

{
background-image:url('smiley.gif');
background-repeat:no-repeat;
background-attachment:fixed;
background-position:right bottom;
}

If you want to choose some other metod for positioning your picture, you can go to: w3 schools site and see which option suits you best (really a good job done by w3 guys). Hope you find a solution. Cheers!

Upvotes: 1

ShaShads
ShaShads

Reputation: 572

You should be able to do this by doing this,

background-attachment:fixed;
background-position:center bottom;

Adding the attachment fixed ensures it stays in the same place when any scrolling takes place.

If this fails to work you could also try,

html {height: 100%;}
body {
    background-position: 0% 100%;
    background-attachment: fixed;
}

Upvotes: 6

kjetilh
kjetilh

Reputation: 4976

This code got it working in Firebug (Firefox). Add the following styles:

<style type="text/css">
html {
    height: 100%;
}

body {
    background-position: 50% 100%;
}
</style>

Upvotes: 0

Jakub Matczak
Jakub Matczak

Reputation: 15656

Try using

background-position: right bottom;

as Lowkase suggested. But to let it work in Firefox and Opera, you should also set

background-attachment: fixed;

It works for me or I didn't understand your question.

Upvotes: 0

Lowkase
Lowkase

Reputation: 5699

Try this in your CSS:

background-position: center bottom;

Upvotes: 0

Related Questions