aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/css/_colon_first
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/_colon_first
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/_colon_first')
-rw-r--r--files/zh-cn/web/css/_colon_first/index.html138
1 files changed, 138 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/_colon_first/index.html b/files/zh-cn/web/css/_colon_first/index.html
new file mode 100644
index 0000000000..ed6b1af264
--- /dev/null
+++ b/files/zh-cn/web/css/_colon_first/index.html
@@ -0,0 +1,138 @@
+---
+title: ':first'
+slug: 'Web/CSS/:first'
+translation_of: 'Web/CSS/:first'
+---
+<div>{{CSSRef}}</div>
+
+<h2 id="简介">简介</h2>
+
+<p><code>:first</code> {{cssxref("@page")}} <a href="/en-US/docs/Web/CSS">CSS</a> <a href="/en-US/docs/Web/CSS/Pseudo-classes">伪类选择器</a> 描述的是:打印文档的时候,第一页的样式。</p>
+
+<div class="note"><strong>提示:</strong>你不能改变所有的css属性. 你只能改变 margins、 orphans、 widows、文档什么时候换页。别的所有css样式都会被忽略。</div>
+
+<h2 id="语法">语法</h2>
+
+<pre class="syntaxbox">{{csssyntax}}</pre>
+
+<h2 id="Example" name="Example">示例</h2>
+
+<h3 id="HTML">HTML</h3>
+
+<pre class="brush: html">&lt;p&gt;First Page.&lt;/p&gt;
+&lt;p&gt;Second Page.&lt;/p&gt;
+&lt;button&gt;Print!&lt;/button&gt;
+</pre>
+
+<h3 id="CSS">CSS</h3>
+
+<pre class="brush: css">@page :first {
+ margin-left: 50%;
+ margin-top: 50%;
+}
+
+p {
+ page-break-after: always;
+}
+</pre>
+
+<h3 id="JavaScript">JavaScript</h3>
+
+<pre class="brush: js">document.querySelector("button").onclick = function(){ window.print() }
+</pre>
+
+<h3 id="结果">结果</h3>
+
+<p>点击下面的 print 按钮来打印这个例子。第一页的文字会在中间显示, 其他页的内容在默认位置显示。</p>
+
+<p>{{ EmbedLiveSample('Example', '80%', '150px') }}</p>
+
+<div class="note"><strong>提示:</strong>在定义margin的时候,你可以只用绝对长度单位, 点击 <a href="/en-US/docs/Web/CSS/length#Absolute_length_units">length</a> 查看更多内容。</div>
+
+<h2 id="规范">规范</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('CSS3 Paged Media', '#left-right-first', ':first')}}</td>
+ <td>{{Spec2('CSS3 Paged Media')}}</td>
+ <td>无更改</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('CSS2.1', 'page.html#page-selectors', ':first')}}</td>
+ <td>{{Spec2('CSS2.1')}}</td>
+ <td>首次定义</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<p>{{CompatibilityTable}}</p>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>特性</th>
+ <th>Chrome</th>
+ <th>Edge</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>基础支持</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatNo}}</td>
+ <td>8.0</td>
+ <td>9.2</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Edge</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>基础支持</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatNo}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="sect1"> </h2>
+
+<h2 id="参见">参见</h2>
+
+<ul>
+ <li>{{Cssxref("@page")}}</li>
+ <li>{{Cssxref(":left")}}</li>
+ <li>{{Cssxref(":right")}}</li>
+</ul>