Html-pre-tag
提供:Dev Guides
HTML-<pre>タグ
説明
HTML <pre>タグは、事前にフォーマットされたテキストを示すために使用されます。 コードタグは、マークアップされるコードを囲みます。
ブラウザは通常、プレテキストを固定ピッチのフォントで、空白をタクトに、ワードラップなしでレンダリングします。
例
<!DOCTYPE html>
<html>
<head>
<title>HTML pre Tag</title>
</head>
<body>
<pre>
This text is
in a fixed-pitch
font, and it preserves
both spaces and line breaks
</pre>
</body>
</html>
これは、次の結果を生成します-
グローバル属性
このタグは、リンク:/html/html_attributes_reference [HTML属性リファレンス]で説明されているすべてのグローバル属性をサポートします
特定の属性
HTML <pre>タグは、次の追加属性もサポートしています-
Attribute | Value | Description |
---|---|---|
width | number | Deprecated − It specifies the desired width of the pre-formatted text. |
イベント属性
このタグは、− link:/html/html_events_reference [HTMLイベントリファレンス]で説明されているすべてのイベント属性をサポートします。
ブラウザのサポート
Chrome | Firefox | IE | Opera | Safari | Android |
---|---|---|---|---|---|
Yes | Yes | Yes | Yes | Yes | Yes |