aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/css/background-position-x
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/css/background-position-x
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/css/background-position-x')
-rw-r--r--files/zh-cn/web/css/background-position-x/index.html100
1 files changed, 100 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/background-position-x/index.html b/files/zh-cn/web/css/background-position-x/index.html
new file mode 100644
index 0000000000..37a9017574
--- /dev/null
+++ b/files/zh-cn/web/css/background-position-x/index.html
@@ -0,0 +1,100 @@
+---
+title: background-position-x
+slug: Web/CSS/background-position-x
+tags:
+ - CSS
+ - CSS Background
+ - CSS Property
+translation_of: Web/CSS/background-position-x
+---
+<div>{{CSSRef}}</div>
+
+<h2 id="概要">概要</h2>
+
+<p><strong><code>background-position-x</code></strong> CSS 属性设置水平方向的位置,与每个背景图片等位置层设置属性 {{cssxref("background-origin")}}相关。更多信息请查看{{cssxref("background-position")}}属性,这个用的比较普遍。</p>
+
+<div class="note"><strong>注意:</strong>这个属性的值会被后面声明的属性覆盖掉,如{{cssxref("background")}}和{{cssxref("background-position")}}等简写的属性。</div>
+
+<p>{{cssinfo}}</p>
+
+<h2 id="Syntax" name="Syntax">语法</h2>
+
+<pre class="brush: css">/* Keyword values */
+background-position-x: left;
+background-position-x: center;
+background-position-x: right;
+
+/* &lt;percentage&gt; values */
+background-position-x: 25%;
+
+/* &lt;length&gt; values */
+background-position-x: 0px;
+background-position-x: 1cm;
+background-position-x: 8em;
+
+/* side-relative values */
+background-position-x: right 3px;
+background-position-x: left 25%;
+
+/* Multiple values */
+background-position-x: 0px, center;
+
+/* Global values */
+background-position-x: inherit;
+background-position-x: initial;
+background-position-x: unset;
+</pre>
+
+<h3 id="值">值</h3>
+
+<dl>
+ <dt><code>left</code></dt>
+ <dd>在位置层上相对于左边的位置。</dd>
+ <dt><code>center</code></dt>
+ <dd>在位置层上相对于中间点的位置。</dd>
+ <dt><code>right</code></dt>
+ <dd>在位置层上相对于右边的位置。</dd>
+ <dt><code>&lt;length&gt;</code></dt>
+ <dd>{{cssxref("&lt;length&gt;")}}值是定义相对于位置层边缘的距离,边缘默认为左边。</dd>
+ <dt><code>&lt;percentage&gt;</code></dt>
+ <dd>{{cssxref("&lt;percentage&gt;")}}值是定义相对于位置层边缘的距离百分比,边缘默认为左边。</dd>
+</dl>
+
+<h3 id="正规语法">正规语法</h3>
+
+<pre class="syntaxbox">{{csssyntax}}</pre>
+
+<h2 id="Specifications" name="Specifications">说明</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Specification</th>
+ <th scope="col">Status</th>
+ <th scope="col">Comment</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('CSS4 Backgrounds', '#background-position-longhands', 'background-position-x')}}</td>
+ <td>{{Spec2('CSS4 Backgrounds')}}</td>
+ <td>Initial specification of longhand sub properties of {{cssxref("background-position")}}  to match longstanding implementations.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="Browser_compatibility" name="Browser_compatibility">兼容性</h2>
+
+<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p>
+
+<p>{{Compat("css/properties/background-position-x", "background-position-x")}}</p>
+
+<h2 id="See_also" name="See_also">更多</h2>
+
+<ul>
+ <li>{{cssxref("background-position")}}</li>
+ <li>{{cssxref("background-position-y")}}</li>
+ <li>{{cssxref("background-position-inline")}}</li>
+ <li>{{cssxref("background-position-block")}}</li>
+ <li><a href="/en-US/docs/CSS/Multiple_backgrounds" title="CSS/Multiple backgrounds">Multiple backgrounds</a></li>
+</ul>