CSS: background-position: ???;
Hopefully these diagrams explain what I'm after. The red signifying the background and the grey the webpage.
Wrong
Right开发者_StackOverflow
How do I achive this? I've tried background-position: bottom right;
but it's just all wrong.
Works fine for me:
body
{
background-image:url('smiley.gif');
background-repeat:no-repeat;
background-attachment:fixed;
background-position:bottom right;
}
And if the picture is big enough the no-repeat isn't needed. (Works even in IE6).
background-position: right bottom;
should do the trick.
Reference: CSS background-position Property
xpos ypos - The first value is the horizontal position and the second value is the vertical. The top left corner is 0 0. Units can be pixels (0px 0px) or any other CSS units. If you only specify one value, the other value will be 50%. You can mix % and positions
background-position: bottom right
should indeed do what you describe.
If you want the image to stick to the bottom-right of the viewport rather than the document, you will have to add background-attachment: fixed
. There are problems with this in IE, but when used on the main body/html background it's fine.
maybe you forgot
background-position: absolute
精彩评论