66

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 image to be located in a bottom right corner of the webpage. How can I achieve this? (better with css method)

Thank You.

Ilja
  • 44,142
  • 92
  • 275
  • 498

4 Answers4

129

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

StudioTime
  • 22,603
  • 38
  • 120
  • 207
Rob W
  • 341,306
  • 83
  • 791
  • 678
24

for more exactly positioning:

      background-position: bottom 5px right 7px;
Arthur Tsidkilov
  • 5,401
  • 2
  • 21
  • 18
13

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

8

Did you try something like:

body {background: url('[url to your image]') no-repeat right bottom;}
markt
  • 5,126
  • 31
  • 25