HTML <pre> width attribute
HTML <pre> tag
Example
Preformatted text width a width of 30 characters:
<pre width="30">
Text in a pre element
is displayed in a fixed-width
font, and it preserves
both
spaces and
line breaks
</pre>
|
Try it yourself!
|
Definition and Usage
The width attribute specifies the maximum number of characters per line.
Browser Support

The width attribute is only supported by Firefox.
Compatibility Notes
The width attribute of the pre element was deprecated in HTML 4.01,
and is not supported in XHTML 1.0 Strict DTD.
Use CSS instead.
CSS syntax: <div style="width:200px;overflow:auto"><pre>Some
text</pre></div>
CSS
Example: preformatted text with a fixed width
In our CSS tutorial you can find more details about the
width property.
Tip: The overflow property adds a scrollbar if the
width of the text exceeds the width of the surrounding element.
Syntax
Attribute Values
Value |
Description |
number |
Sets the width in number of characters |
HTML <pre> tag
 |

|
|
See why there are 20,000+ Ektron integrations worldwide.
Request an INSTANT DEMO or download a FREE TRIAL today. |
|
|
|