2011-10-11 24 views
41

私は自分のウェブサイトに背景画像として設定された500x500ピクセルの画像を持っています(背景画像は<body>です)。しかし、この画像はウェブページの右下に表示されている必要があります。どうすればこれを達成できますか? (CSS方式でより良い)右下に背景画像を配置するにはどうすればよいですか?

ありがとう。

答えて

80

Voilla:

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

+1

Thnx、今日は静かに助けてくれました)) – Ilja

+0

背景画像が画面の高さよりも高いときには... – Legionar

+0

@Legionar Chrome 43&Firefox 38で動作します。 –

7

は、あなたのようなものを試してみました:

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

を:

 background-position: bottom 5px right 7px; 
+1

ピクセルを介した「ドッキングポイント」に対する背景画像の微調整 –

関連する問題