When writing in HTML, the
tag is a block element used to designate preformatted text. It is useful because the text betweentags has its spaces and line breaks preserved, in addition to being displayed in a fixed-width font. The following sections contain information about this tag, including an example of it in use, and related attributes and browser compatibility.Example of
codeThis is a sentence with some preformatted text.Example result
This is a sentence with some preformatted text.
Deprecated attributes
Within an HTML tag, an attribute dictates certain aspects of an HTML element. Attributes are made up of a name and value pair; all tags support standard attributes. The only attribute unique to the
tag is deprecated, meaning that it may function currently, but is not supported in going forward. In this case, CSS should be used in place of these attributes.The
tag is quite useful for displaying organized computer code.
- Example of
code
- Example result
- Deprecated attributes
- Compatibility
- Related information
Compatibility
Browser, Compatibility, Container tag, Paragraph, Web design terms
Related information
- How to change the text line spacing.
- How to center text in HTML.
- HTML and web design help and support.