将CSS背景图片从右侧定位x像素? [英] Position a CSS background image x pixels from the right?

查看:384
本文介绍了将CSS背景图片从右侧定位x像素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我认为答案是否定的,但是你可以使用CSS定位背景图片,以使它距离右侧有固定的像素数量?

I think the answer is no, but can you position a background image with CSS, so that it is a fixed amount of pixels away from the right?

如果我设置 background-position x和y的值,它似乎只分别从左边和顶部给固定的像素调整。

If I set background-position values of x and y, it seems those only give fixed pixel adjustments from the left and top respectively.

推荐答案

background-position: right 30px center;

它适用于Firefox和Chrome。请尝试在其他浏览器中测试!

It works in Firefox and Chrome. Try testing in other browser please!

更多信息: http://www.w3.org/TR/css3-background/#the-background-position

这篇关于将CSS背景图片从右侧定位x像素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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