# pre element

Type: | Text Blocks
Attributes: | orphans • text-align • text-indent • color • font-family • font-feature-settings • font-stretch • font-style • font-variant • font-weight • font • justification-ratio • letter-spacing • outline-color • outline-width • overprint • requote • suppress-ligatures • text-decoration • text-transform • align • background-color • background-image-dpi • background-image-position • background-image • background-pdf • border-color • border-style • border-width • border • clear • corner-radius • display • float • font-size • height • href • left • line-cap • line-height • line-join • margin • onmouseover • overflow • padding • page-break-after • page-break-inside • position • rotate • size • top • vertical-align • visibility • white-space • width • class • colorspace • direction • id • lang
See: | a i p span u

The pre tag displays preformatted text in a fixed-width font. Other than this it's identical to p
The pre element displays all white space and line breaks exactly as they appear inside the <PRE> and </PRE> tags.
Using this tag, you can insert and reproduce formatted text, preserving its original layout. This tag is frequently used to show code listings, tabulated information, and blocks of text that were created for some text-only form, such as email messages.
XML tags inside the pre tag are still interpreted - since the pre is just another type of paragraph, span tags and their varients (b, i, u, a etc.) may be used to format the text.
See the p element examples of general layout applicable to all paragraphs, including PRE

The text inside the PRE tag will keep the same spacing you can see here.

    <p>Here is a preformatted block of text.</p>
    <pre>
    public class HelloWorld {
        public static void main(String[] args) {
            System.out.println("Hello World");
        }
    }
    </pre>