如何在右下角定位背景图像?(CSS) [英] How to position background image in bottom right corner? (CSS)

查看:24
本文介绍了如何在右下角定位背景图像?(CSS)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个 500x500 像素的图像,它在我的网站上设置为背景图像(作为 <body> 的背景图像)但我需要此图像位于右下角的网页.我怎样才能做到这一点?(用css方法更好)

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)

谢谢.

推荐答案

瞧:

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

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

这篇关于如何在右下角定位背景图像?(CSS)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆