背景图像可以大于 div 本身吗? [英] Can a background image be larger than the div itself?

查看:29
本文介绍了背景图像可以大于 div 本身吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 100% 宽度的页脚 div.它大约 50 像素高,具体取决于其内容.

I have a footer div with 100% width. It's about 50px high, depending on its content.

是否可以给那个#footer 一个背景图片,这种图片会溢出这个div?

Is it possible to give that #footer a background image that kind of overflows this div?

图片大小约为 800x600px,我希望它位于页脚的左下角.它应该有点像我网站的背景图片,但我已经在我的身体上设置了背景图片.我需要在我的网站左下角放置另一张图片,#footer 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;
}

图像设置为页脚,但不会溢出 div.有可能实现吗?

The image is set to the footer, however it doesn't overflow the div. Is it possible to make that happen?

overflow:visible 不起作用!

推荐答案

我不相信你可以让背景图片溢出它的 div.放置在 Image 标签中的图像可能会溢出其父 div,但背景图像受其作为背景的 div 的限制.

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.

这篇关于背景图像可以大于 div 本身吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆