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 t
No, you can't.
But as a solid workaround, I would suggest to classify that first div as position:relative
and use div::before
to create an underlying element containing your image. Classified as position:absolute
you can move it anywhere relative to your initial div.
Don't forget to add content to that new element. Here's some example:
div {
position: relative;
}
div::before {
content: ""; /* empty but necessary */
position: absolute;
background: ...
}
Note: if you want it to be 'on top' of the parent div, use div::after
instead.
Not really - the background image is bounded by the element it's applied to, and the overflow properties only apply to the content (i.e. markup) within an element.
You can add another div into your footer div and apply the background image to that, though, and have that overflow instead.
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 with position: relative
, a negative z-index
so it stays "below" everything, and a negative top
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.