aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/css/background-position-y
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-y
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-y')
-rw-r--r--files/zh-cn/web/css/background-position-y/index.html100
1 files changed, 100 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/background-position-y/index.html b/files/zh-cn/web/css/background-position-y/index.html
new file mode 100644
index 0000000000..a596d59547
--- /dev/null
+++ b/files/zh-cn/web/css/background-position-y/index.html
@@ -0,0 +1,100 @@
+---
+title: background-position-y
+slug: Web/CSS/background-position-y
+tags:
+ - CSS 背景
+ - 参考
+ - 实验性
+translation_of: Web/CSS/background-position-y
+---
+<div>{{CSSRef}}</div>
+
+<h2 id="摘要">摘要</h2>
+
+<p><strong><code>background-position-y</code></strong> 属性用于设置初始状态时背景图片在垂直方向上的位置,这个位置相对于通过 {{cssxref("background-origin")}} 定义的背景层的原点进行定位. 需要获得更多的信息可以查看{{cssxref("background-position")}} 属性,这个属性已经得到了长久且广泛的支持.</p>
+
+<div class="note"><strong>注意:</strong> <code>background-position-y</code> 设定的值会被 {{cssxref("background")}} 或者是 {{cssxref("background-position")}} 的简写属性的<code>background-position-x</code>后面的值所覆盖.</div>
+
+<pre class="brush:css no-line-numbers">/* Keyword values */
+background-position-y: top;
+background-position-y: center;
+background-position-y: bottom;
+
+/* &lt;percentage&gt; values */
+background-position-y: 25%;
+
+/* &lt;length&gt; values */
+background-position-y: 0px;
+background-position-y: 1cm;
+background-position-y: 8em;
+
+/* side-relative values */
+background-position-y: bottom 3px;
+background-position-y: bottom 10%;
+
+/* Multiple values */
+background-position-y: 0px, center;
+
+/* Global values */
+background-position-y: inherit;
+background-position-y: initial;
+background-position-y: unset;
+</pre>
+
+<p>{{cssinfo}}</p>
+
+<h2 id="Syntax" name="Syntax">语法</h2>
+
+<h3 id="合法值">合法值</h3>
+
+<dl>
+ <dt><code>top</code></dt>
+ <dd>将背景图片的上边界与背景位置层的上边界对齐.</dd>
+ <dt><code>center</code></dt>
+ <dd>将背景图片垂直方向上的中线与背景位置层的垂直方向中线对齐.</dd>
+ <dt><code>bottom</code></dt>
+ <dd>将背景图片的下边界与背景位置层的下边界对齐.</dd>
+ <dt><code>&lt;length&gt;</code></dt>
+ <dd> 通过{{cssxref("&lt;length&gt;")}} 直接设定具体的数值,该数值定义了背景图片垂直方向的上边界相对于当前背景层(content-box/padding-box/border-box)的垂直方向上边界的偏移量,默认情况下是padding-box.</dd>
+ <dt><code>&lt;percentage&gt;</code></dt>
+ <dd>通过{{cssxref("&lt;percentage&gt;")}} 百分比的设置,该百分比定义了背景图片垂直方向的上边界相对于当前背景层(content-box/padding-box/border-box)的垂直方向上边界的偏移百分比,从而得到偏移量,该偏移量的计算方法是:(当前背景层的高-背景图片的高) * 百分比,高度差和百分比都保留符号,例如(100px - 200px) * (-10%) = 10px那么偏移量就是正的10px(向下为正方向),默认情况下是padding-box.</dd>
+</dl>
+
+<h3 id="Formal_syntax">Formal syntax</h3>
+
+<pre class="syntaxbox">{{csssyntax}}</pre>
+
+<h2 id="Specifications" name="Specifications">规范</h2>
+
+<table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">规范</th>
+ <th scope="col">状态</th>
+ <th scope="col">说明</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td>{{SpecName('CSS4 Backgrounds', '#background-position-longhands', 'background-position-y')}}</td>
+ <td>{{Spec2('CSS4 Backgrounds')}}</td>
+ <td>Initial specification of longhand subproperties 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-y")}}</p>
+
+<h2 id="See_also" name="See_also">另见</h2>
+
+<ul>
+ <li>{{cssxref("background-position")}}</li>
+ <li>{{cssxref("background-position-x")}}</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>