我有一张500x500像素的图片,它被设置为我的网站的背景图片(作为
谢谢。
<body>
的背景图像)。但是我需要将这张图片放在网页的右下角。如何实现这一目标?(最好使用CSS方法)谢谢。
<body>
的背景图像)。但是我需要将这张图片放在网页的右下角。如何实现这一目标?(最好使用CSS方法)这就是:
body {
background-color: #000; /*Default bg, similar to the background's base color*/
background-image: url("bg.png");
background-position: right bottom; /*Positioning*/
background-repeat: no-repeat; /*Prevent showing multiple background images*/
}
背景属性可以结合在一起,放在一个背景属性中。
另请参见:https://developer.mozilla.org/en/CSS/background-position
更精确地定位:
background-position: bottom 5px right 7px;
<style>
body {
background:url(bg.jpg) fixed no-repeat bottom right;
}
</style>
您是否尝试过类似以下的操作:
body {background: url('[url to your image]') no-repeat right bottom;}
jquery
把bottom
改成了0
... :-/ - Legionarbackground-attachment: fixed;
才能使其正常工作。 - Brian Riskbackground-attachment: fixed;
可以避免这个问题。 - Brian Moeskau