我的页面正文中有一个背景图像设置在右下角。但是,当页面内的内容超出屏幕时,背景图像会停止在屏幕边缘,而不是实际内容结束的位置。
这是相关的CSS:
html, body {
margin : 0;
padding : 0;
font-family : arial, sans-serif;
background-color : #15242d;
height: 100%;height:auto;
min-width: 100%;width:auto;
font-size: 15px;
color: #959595;
}
body {
background-image : url(images/body_bkg.gif);
background-repeat: no-repeat;
background-position:right bottom;
}
解决这个问题的最佳方法是什么?
最佳答案
如果您还没有,则需要将网站内容包装在一个包含 div
中,该 div
将扩展到内容的大小。然后,您需要将背景图像应用到该 div
,而不是将其放在 body
上。
关于css - 正文宽度为页面而非屏幕的 100%,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8383848/