I have a footer div with 100% width. It's about 50px high, depending on its content.
Is it possible to give that #footer a background image that kind of overflows this div?
The image is about 800x600px, and I want it to be positioned in the left bottom corner of the footer. It should work sort of like a background image for my website, but I've already set a background image on my body. I need another image positioned at the bottom left corner of my website and the #footer div would be perfect for that.
#footer {
clear: both;
width: 100%;
margin: 0;
padding: 30px 0 0;
background:#eee url(images/bodybgbottomleft.png) no-repeat left bottom fixed;
}
The image is set to the footer, however it doesn't overflow the div. Is it possible to make that happen?
overflow:visible
doesn't do the job!
Using background-size cover worked for me.
Obviously be aware of support issues, check Can I Use: http://caniuse.com/#search=background-size
This could help. It requires the footer height to be a fixed number. Basically, you have a div inside the footer div with it's normal content, with
position: absolute
, and then the image withposition: relative
, a negativez-index
so it stays "below" everything, and a negativetop
value of the footer's height minus the image height (in my example,50px - 600px = -550px
). Tested in Chrome 8, FireFox 3.6 and IE 9.I do not believe that you can make a background image overflow its div. Images placed in Image tags can overflow their parent div, but background images are limited by the div for which they are the background.