From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- files/zh-cn/web/html/element/code/index.html | 106 +++++++++++++++++++++++++++ 1 file changed, 106 insertions(+) create mode 100644 files/zh-cn/web/html/element/code/index.html (limited to 'files/zh-cn/web/html/element/code/index.html') diff --git a/files/zh-cn/web/html/element/code/index.html b/files/zh-cn/web/html/element/code/index.html new file mode 100644 index 0000000000..1090396027 --- /dev/null +++ b/files/zh-cn/web/html/element/code/index.html @@ -0,0 +1,106 @@ +--- +title: +slug: Web/HTML/Element/code +translation_of: Web/HTML/Element/code +--- +

摘要

+

HTML <code> 元素呈现一段计算机代码. 默认情况下, 它以浏览器的默认等宽字体显示.

+ +

属性

+

此元素仅包含 全局属性.

+

例子

+
<p>Regular text. <code>This is code.</code> Regular text.</p>
+
+

结果

+

Regular text. This is code. Regular text.

+

(中文的等宽字和正常字看起来区别不大, 因为汉字本身就是方块行. 但是仍能看出几行文字之间的对齐差异)

+

注意

+

CSS 规则可以覆盖浏览器默认的 code 标签字体样式. 但用户设置的浏览器字体选项可能会超过 CSS 的优先级, 使之无效.

+

Specifications

+ + + + + + + + + + + + + + + + + + + + + + + + + +
SpecificationStatusComment
{{SpecName('HTML WHATWG', 'text-level-semantics.html#the-code-element', '<code>')}}{{Spec2('HTML WHATWG')}} 
{{SpecName('HTML5 W3C', 'text-level-semantics.html#the-code-element', '<code>')}}{{Spec2('HTML5 W3C')}} 
{{SpecName('HTML4.01', 'struct/text.html#h-9.2.1', '<code>')}}{{Spec2('HTML4.01')}} 
+

浏览器兼容性

+

{{CompatibilityTable}}

+
+ + + + + + + + + + + + + + + + + + + +
FeatureChromeFirefox (Gecko)Internet ExplorerOperaSafari (WebKit)
Basic support1.0{{CompatGeckoDesktop("1.0")}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
+
+
+ + + + + + + + + + + + + + + + + + + +
FeatureAndroidFirefox Mobile (Gecko)IE PhoneOpera MobileSafari Mobile
Basic support{{CompatVersionUnknown}}{{CompatGeckoMobile("1.0")}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}{{CompatVersionUnknown}}
+
+

See also

+ +
+ {{HTMLRef}}
-- cgit v1.2.3-54-g00ecf