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!
There is a very easy trick. Set padding of that div to a positive number and margin to negativ
Use trasform: scale(1.1) property to make bg image bigger, move it up with position: relative; top: -10px;
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.
You can use a css3 psuedo element as shown in this article
https://www.exratione.com/2011/09/how-to-overflow-a-background-image-using-css3/
You mention already having a background image on
body
.You could set that background image on
html
, and the new one onbody
. This will of course depend upon your layout, but you wouldn't need to use your footer for it.No, you can't.
But as a solid workaround, I would suggest to classify that first div as
position:relative
and usediv::before
to create an underlying element containing your image. Classified asposition: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:
Note: if you want it to be 'on top' of the parent div, use
div::after
instead.