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/ja/web/html/element/code/index.html | 120 ++++++++++++++++++++++++++++++ 1 file changed, 120 insertions(+) create mode 100644 files/ja/web/html/element/code/index.html (limited to 'files/ja/web/html/element/code') diff --git a/files/ja/web/html/element/code/index.html b/files/ja/web/html/element/code/index.html new file mode 100644 index 0000000000..72dbc333bf --- /dev/null +++ b/files/ja/web/html/element/code/index.html @@ -0,0 +1,120 @@ +--- +title: ': 行内コード要素' +slug: Web/HTML/Element/code +tags: + - Code + - Element + - HTML + - HTML text-level semantics + - Inline Code + - Reference + - Web +translation_of: Web/HTML/Element/code +--- +
{{HTMLRef}}
+ +

HTML の <code> 要素は、コンピューターコードの短い断片の文字列であると識別できるような外見のコンテンツを表示します。既定では、中の文字列が{{Glossary("user agent", "ユーザーエージェント")}}の既定の等幅フォントを使用して表示されます。

+ +
{{EmbedInteractiveExample("pages/tabbed/code.html", "tabbed-shorter")}}
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
コンテンツカテゴリフローコンテンツ, 記述コンテンツ, 知覚可能コンテンツ
許可されている内容記述コンテンツ
タグの省略{{no_tag_omission}}
許可されている親要素記述コンテンツを受け入れるすべての要素
暗黙の ARIA ロール対応するロールなし
許可されている ARIA ロールすべて
DOM インターフェイス{{domxref("HTMLElement")}}。Gecko 1.9.2 (Firefox 4) 以前では、この要素には {{domxref("HTMLSpanElement")}} インターフェイスが実装されています。
+ +

属性

+ +

この要素にはグローバル属性以外の属性はありません。

+ +

+ +

<code> を含むテキストの段落です。

+ +
<p>The function <code>selectAll()</code> highlights all the text in the
+input field so the user can, for example, copy or delete the text.</p>
+
+ +

この HTML によって生成される出力は以下のようになります。

+ +

{{EmbedLiveSample("Example", 640, 70)}}

+ +

補足

+ +

複数行のコードを表すには、 <code> 要素を {{HTMLElement("pre")}} 要素の中に入れてください。 <code> 要素自身は、コードの単一のフレーズや1行のみを表します。

+ +

CSS の規則によって、 code セレクターを定義して、ブラウザーの既定のフォントを上書きすることができます。ユーザーによる設定を CSS による指定より優先させることもできます。

+ +

仕様書

+ + + + + + + + + + + + + + + + + + + + + + + + + + +
仕様書状態備考
{{SpecName('HTML WHATWG', 'semantics.html#the-code-element', '<code>')}}{{Spec2('HTML WHATWG')}}
{{SpecName('HTML5 W3C', 'textlevel-semantics.html#the-code-element', '<code>')}}{{Spec2('HTML5 W3C')}}
{{SpecName('HTML4.01', 'struct/text.html#h-9.2.1', '<code>')}}{{Spec2('HTML4.01')}}
+ +

ブラウザーの互換性

+ + + +

{{Compat("html.elements.code")}}

+ +

関連情報

+ + -- cgit v1.2.3-54-g00ecf