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/plaintext/index.html | |
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/plaintext/index.html')
-rw-r--r-- | files/zh-cn/web/html/element/plaintext/index.html | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/files/zh-cn/web/html/element/plaintext/index.html b/files/zh-cn/web/html/element/plaintext/index.html new file mode 100644 index 0000000000..c962ae74e0 --- /dev/null +++ b/files/zh-cn/web/html/element/plaintext/index.html @@ -0,0 +1,41 @@ +--- +title: <plaintext> +slug: Web/HTML/Element/plaintext +translation_of: Web/HTML/Element/plaintext +--- +<div>{{Obsolete_header}}</div> + +<h2 id="概述">概述</h2> + +<p><em>HTML 纯文本元素</em> (<code><plaintext></code>) 将起始标签后面的任何东西渲染为纯文本,不会解释为 HTML。它没有闭合标签,因为任何后面的东西都会看做纯文本。</p> + +<div class="note"><strong>注:</strong>不要使用这个元素。 + +<ul> + <li>它自从 HTML3.2 就废弃了,并且所有浏览器也不会实现它。此外,它在 HTML5 中已过时;仍然接受它的浏览器,可能将其看做 {{HTMLElement("pre")}} 元素,它仍然会解释其中的 HTML,即使这不是你想要的结果。</li> + <li>如果 {{HTMLElement("plaintext")}} 元素是页面的第一个元素(除了任何不显示的元素),那就不要使用 HTML 了。配置你的服务器,使用 <code>text/plain</code> <a href="/en-US/docs/Properly_Configuring_Server_MIME_Types" title="Properly Configuring Server MIME Types">MIME-type</a> 来发送你的页面。</li> + <li>不要使用这个元素,你应该使用 {{HTMLElement("pre")}} 元素,或者如果满足语义的话,使用 {{HTMLElement("code")}} 元素。要确保转义了任何 '<code><</code>' 、' <code>></code>' 和 "&" 字符,来避免将内容解释为 HTML。</li> + <li>等宽字体也可以显示在 {{HTMLElement("div")}} 元素中,通过使用足够的 <a href="https://developer.mozilla.org/en-US/docs/Web/CSS" title="CSS">CSS</a> 样式,在 {{cssxref("font-family")}} 中将 <code>monospace</code> 用作通用字体(generic-font)的值。</li> +</ul> +</div> + +<h2 id="属性">属性</h2> + +<p>除了 <a href="https://developer.mozilla.org/en-US/docs/Web/HTML/global_attributes" rel="internal" title="HTML/global attributes">全局属性</a> 之外,这个元素没有其它属性。</p> + +<h2 id="DOM_接口">DOM 接口</h2> + +<p>元素实现了 {{domxref('HTMLElement')}} 接口。</p> + +<div class="note"> +<p><strong>实现注解:</strong>直到 Gecko 1.9.2(包含),Firefox 为这个元素实现了 {{domxref('HTMLSpanElement')}} 接口。</p> +</div> + +<h2 id="另见">另见</h2> + +<ul> + <li>{{HTMLElement("pre")}} 和 {{HTMLElement("code")}} 元素可以用于替代。</li> + <li>{{HTMLElement("listing")}} 和 {{HTMLElement("xmp")}} 元素,类似于 {{HTMLElement("plaintext")}} 但是也过时了。</li> +</ul> + +<div>{{HTMLRef}}</div> |