The pre Tag
The `<pre>` tag in HTML defines a block of preformatted text, preserving spaces, line breaks, tabs, and other formatting characters that browsers usually ignore. Text within the `<pre>` element is displayed in a fixed-width font, but this can be changed using CSS. The `<pre>` tag requires both opening and closing tags.
Syntax:
<pre> Contents... </pre>
Example: To demonstrate implementing the <pre> Tag in the HTML computer code elements.
<!DOCTYPE html>
<html>
<head>
<title>pre tag with CSS</title>
<style>
pre {
font-family: Arial;
color: #009900;
margin: 25px;
}
</style>
</head>
<body>
<pre>
w3wiki
A Computer Science Portal For Geeks
</pre>
</body>
</html>
Output:
HTML Computer Code Elements
The computer has a unique formatting and text style for displaying the messages related to codes. There are several elements available to mark up computer code elements using HTML which are as follows:
Table of Content
- The code Tag
- The kbd Tag
- The pre Tag
- The samp Tag
- The var Tag
- HTML Computer Code Elements
- Supported Browsers