THE WORLD'S LARGEST WEB DEVELOPER SITE
HTMLCSSJAVASCRIPTSQLPHPBOOTSTRAPJQUERYANGULARXML
 

HTML DOM Pre Object


Pre Object

The Pre object represents an HTML <pre> element.

Access a Pre Object

You can access a <pre> element by using getElementById():

Example

var x = document.getElementById("myPre");
Try it Yourself »

Create a Pre Object

You can create a <pre> element by using the document.createElement() method:

Example

var x = document.createElement("PRE");
Try it Yourself »

Pre Object Properties

Property Description
width Not supported in HTML5. Use style.width instead.
Sets or returns the value of the width attribute of the preformatted text

Standard Properties and Events

The Pre object also supports the standard properties and events.


Related Pages

HTML Tutorial: HTML Text Formatting

HTML Reference: HTML <pre> tag