diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/html/element/var | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/html/element/var')
-rw-r--r-- | files/zh-cn/web/html/element/var/index.html | 128 |
1 files changed, 128 insertions, 0 deletions
diff --git a/files/zh-cn/web/html/element/var/index.html b/files/zh-cn/web/html/element/var/index.html new file mode 100644 index 0000000000..25c6460a5f --- /dev/null +++ b/files/zh-cn/web/html/element/var/index.html @@ -0,0 +1,128 @@ +--- +title: <var> +slug: Web/HTML/Element/var +tags: + - HTML + - Web +translation_of: Web/HTML/Element/var +--- +<div></div> + +<div></div> + +<div>{{HTMLRef}}</div> + +<div></div> + +<div>HTML Variable元素(<var>)表示数学表达式或编程上下文中的变量名称。尽管该行为取决于浏览器,但通常使用当前字体的斜体形式显示。</div> + +<h2 id="概述">概述</h2> + +<p><strong><var> 标签</strong>表示变量的名称,或者由用户提供的值。</p> + +<table class="standard-table"> + <tbody> + <tr> + <td>允许内容</td> + <td>Phrasing content</td> + </tr> + <tr> + <td>标签闭合</td> + <td>Both start and end tags are required</td> + </tr> + <tr> + <td>允许的父级元素</td> + <td>Any element that accepts <a href="/en-US/docs/HTML/Content_categories#Phrasing_content" title="HTML/Content categories#Phrasing content">phrasing content</a>.</td> + </tr> + <tr> + <td>规范元素</td> + <td><a href="http://www.whatwg.org/html/#the-var-element">HTML, "The <code>var</code> element"</a></td> + </tr> + </tbody> +</table> + +<h2 id="属性">属性</h2> + +<p><span style="line-height: 21px;">本元素仅支持 </span><a href="https://developer.mozilla.org/en-US/docs/HTML/Global_attributes" style="line-height: 21px;" title="HTML/Global attributes">全局属性</a><span style="line-height: 21px;">.</span></p> + +<h2 id="DOM_接口">DOM 接口</h2> + +<p>本元素支持 <code><a href="/en-US/docs/DOM/element" title="DOM/element">HTMLElement</a></code> 接口</p> + +<div class="note"> +<p><strong>提示: </strong>Gecko 1.9.2 开始, Firefox支持本元素使用 <a href="/en-US/docs/DOM/span" title="DOM/span"><span style="font-family: courier new;">HTMLSpanElement</span></a> 接口。</p> +</div> + +<h2 id="默认样式">默认样式</h2> + +<pre class="brush:css">var { + font-style: italic; +} +</pre> + +<h2 id="示例">示例</h2> + +<pre class="brush:html"><p> A simple equation: <var>x</var> = <var>y</var> + 2 </p> +</pre> + +<p>A simple equation: <var>x</var> = <var>y</var> + 2</p> + +<div> +<p>The output:</p> + +<p>{{EmbedLiveSample("Basic_example", 650,80)}}</p> +</div> + +<div> +<h3 id="Overriding_the_default_style">Overriding the default style</h3> + +<p>Using CSS, you can override the default style for the <code><var></code> element. In this example, variable names are rendered using bold Courier if it's available, otherwise it falls back to the default monospace font.</p> + +<h4 id="CSS">CSS</h4> + +<pre>var { + font: bold 15px "Courier", "Courier New", monospace; +}</pre> + +<h4 id="HTML">HTML</h4> + +<pre><p>The variables <var>minSpeed</var> and <var>maxSpeed</var> control + the minimum and maximum speed of the apparatus in revolutions + per minute (RPM).</p></pre> + +<p>This HTML uses <code><var></code> to enclose the names of two variables.</p> + +<h4 id="Result">Result</h4> + +<p>{{EmbedLiveSample("Overriding_the_default_style", 650, 120)}}</p> + +<h2 id="Specifications">Specifications</h2> + +<table> + <thead> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + </thead> + <tbody> + <tr> + <td>{{SpecName('HTML WHATWG', 'text-level-semantics.html#the-var-element', '<var>')}}</td> + <td>{{Spec2('HTML WHATWG')}}</td> + <td></td> + </tr> + <tr> + <td>{{SpecName('HTML5 W3C', 'textlevel-semantics.html#the-var-element', '<var>')}}</td> + <td>{{Spec2('HTML5 W3C')}}</td> + <td></td> + </tr> + </tbody> +</table> + +<h2 id="Browser_compatibility">Browser compatibility</h2> + +<p>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("html.elements.var")}}</p> +</div> |