Reputation: 369
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> Home </span><img src="images/home.png" alt="[photo]" /></a></li><!--
--><li><a href="/bio.html"><span> Bio </span><img src="images/bio.png" alt="[photo]" /></a></li><!--
--><li><a href="/resume.html"><span> Resume </span><img src="images/resume.png" alt="[photo]" /></a></li><!--
--><li class="active"><a href="/collections.html"><span> Collections </span><img src="images/collections.png" alt="[photo]" /></a></li><!--
--><li class="active"><a href="/references.html"><span> References </span><img src="images/references.png" alt="[photo]" /></a></li><!--
--><li><a href="/contact.html"><span> Contact </span><img src="images/email.png" alt="[photo]" /></a></li><!--
--><li><a href="/blog.html"><span> Blog </span><img src="images/blog.png" alt="[photo]" /></a></li><!--
--><li><a href="http://www.facebook.com/alexklinghoffer"><span> Facebook </span><img src="images/facebook.png" alt="[photo]" /></a></li><!--
--><li><a href="http://www.linkedin.com/in/alexklinghoffer"><span> LinkedIn </span><img src="images/linkedin.png" alt="[photo]" /></a></li>
</ul>
</div>
<div id="content">
</div>
<div id="footer">
<p>© 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
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
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
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
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