HTML Pre Tag
2. Preformatted Text (<pre>
)
The <pre>
tag preserves the whitespace and line breaks exactly as written in the source code. It is often used to display code snippets or formatted text.
Attributes:
width
(deprecated): Specifies the width of the preformatted text block.
Example:
<pre>
function helloWorld() {
console.log("Hello, World!");
}
</pre>
Explanation:
- Displays the text exactly as it appears in the code block, maintaining formatting.
Comments
Post a Comment