开发者

How to position background image in bottom right corner? (CSS) [duplicate]

开发者 https://www.devze.com 2023-04-12 12:41 出处:网络
This question already has answers here: Offset a background image from the right using CSS (17 answers)
This question already has answers here: Offset a background image from the right using CSS (17 answers) Position a CSS background image x pixels from the right? (21 answers) Closed 2 years ago.

I have a 500x500 px image which is set as a background image on my website (as background-image of <body>) But I need this i开发者_StackOverflowmage to be located in a bottom right corner of the webpage. How can I achieve this? (better with css method)

Thank You.


Voilà:

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*/
}

The background properties can be combined together, in one background property. See also: https://developer.mozilla.org/en/CSS/background-position


for more exactly positioning:

      background-position: bottom 5px right 7px;


This should do it:

<style>
body {
    background:url(bg.jpg) fixed no-repeat bottom right;
}
</style>

http://www.w3schools.com/cssref/pr_background-position.asp


Did you try something like:

body {background: url('[url to your image]') no-repeat right bottom;}
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号