HTML CSS examples for HTML Tag:pre
pre marks Preformatted Content, such as computer code.
The pre element preserves the whitespace from collapsing.
The pre Element summary
Item | Value |
---|---|
Element | pre |
Local Attributes | None |
Tag Style | Start and end tag required |
New in HTML5 | No |
Changes in HTML5 | None |
Style Convention
pre { display: block; font-family: monospace; white-space: pre; margin: 1em 0; }
Using the pre Element
<!DOCTYPE html> <html> <head> <title>Example</title> </head> <body> <pre> <code> var items = ["CSS", "HTML", "mangoes", "Oracle"]; for (var i = 0; i < items.length; i++) { document.writeln("I like " + items[i]); }<!--from ww w. j av a 2s . c o m--> </code> </pre> </body> </html>