CSS 如何设置背景位置x?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10996705/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 04:10:28  来源:igfitidea点击:

How-to set background-position-x?

cssopera

提问by Astronaut

How Do i set background-position-x on Opera?

我如何在 Opera 上设置 background-position-x?

div#logocontainer{
    width: auto;
    height: auto;
    text-align: center;
    line-height: 200px;
    overflow: auto;
    margin-left: auto;
    margin-right: auto;
    background-image: url(../img/WatermarkMP.png);
    background-repeat: no-repeat;
    background-position-x: 50%;
    background-position-y: 50%;
    padding: 10px;
}

I have the following CSS rule, it will display correctly on Chrome and Safari, desktop and mobile versions. But it will not work on Opera, that does not seem to support the background-position-x: 50%; background-position-y: 50%; rules. Do I have to script this so that it's compatible with Opera? How do I work around this to support opera also?

我有以下 CSS 规则,它将在 Chrome 和 Safari、桌面和移动版本上正确显示。但它不适用于Opera,它似乎不支持background-position-x: 50%; 背景位置y:50%;规则。我是否必须编写脚本以使其与 Opera 兼容?我如何解决这个问题以支持歌剧?

It also does not seem to round jQuery Mobile corners...

它似乎也没有绕过 jQuery Mobile 角...

回答by duri

You have to set background-position: 50% 50%. Those -xand -yproperties are only supported in Internet Explorer and Webkit browsers.

你必须设置background-position: 50% 50%. 这些-x-y属性仅在 Internet Explorer 和 Webkit 浏览器中受支持。