English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Referenzhandbuch

HTML-Tag-Verzeichnis

HTML pre width Eigenschaft

Die "pre width"-Eigenschaft spezifiziert die maximale Anzahl von Zeichen pro Zeile. Nur Firefox unterstützt Version1.0 to29.0's width attribute.

 HTML <pre> Tag

Online-Beispiel

Formatierter Text, Breite40 Zeichen:

!DOCTYPE html
<html>
<head>
<title>HTML: <width> name Eigenschaft - Grundlagen-Tutorial-Website(oldtoolbag.com)</title>
</head>
<body>
<p>Normale "pre":</p>
<pre>
Text in einem "pre"-Element wird in einer festen-Breite
Schriftart, und es bewahrt sowohl Leerraum als auch
Zeilenbrüche
</pre>
<p>Definition einer spezifischen Breite für "pre":</p>
<pre width="40">
Text in einem "pre"-Element wird in einer festen-Breite
Schriftart, und es bewahrt sowohl Leerraum als auch
Zeilenbrüche
</pre>
</body>
</html>
Testen Sie es heraus ‹/›

Browser-Kompatibilität

IEFirefoxOperaChromeSafari

 Firefox Supported Version1.0 to29.0's width attribute.

Definition and Usage

HTML5 The <pre> width attribute is not supported. Please use CSS instead.

In HTML 4.01 In the <pre> tag, the width attribute is deprecated.

The width attribute specifies the maximum number of characters per line.

Compatibility Notes

In HTML 4.01 In the <pre> tag, the width attribute is deprecated. Please use CSS instead.

CSS Syntax:<div style="width:200px;overflow:auto"><pre>Some text</pre></div>

CSS Example: Preformatted text with fixed width

In our CSS tutorial, you can find more about width attribute details.

Tip:If the text width exceeds the width of the surrounding element, the overflow attribute adds a scrollbar.

Syntax

<pre width="number">

Attribute Value

ValueDescription
numberSet the width in number of characters.
 HTML <pre> Tag