pre element

Type:Text Blocks
Attributes: line-break  •  orphans  •  text-align  •  text-indent  •  word-break  •  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  •  alt  •  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  •  title  •  top  •  vertical-align  •  visibility  •  white-space  •  width  •  class  •  colorspace  •  direction  •  id  •  lang  •  pdf-tag-background-color  •  pdf-tag-border-color  •  pdf-tag-border-style  •  pdf-tag-border-thickness  •  pdf-tag-color  •  pdf-tag-list-numbering  •  pdf-tag-placement  •  pdf-tag-table-colspan  •  pdf-tag-table-headers  •  pdf-tag-table-rowspan  •  pdf-tag-table-scope  •  pdf-tag-table-summary  •  pdf-tag-text-align  •  pdf-tag-type
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>