HTML provides some special block elements which you can use to code for text. For example, three of the most common elements that are as follows:
HTML Special Block Elements
Block Element | Description |
---|---|
pre | Used for portions of code that are formatted with line breaks and spaces. Creates a block of pre-formatted text that preserves white-space and is displayed in a monospaced font. |
blockquote | Used for quotations. Can be used with the cite and elements. |
address | Used for contact information for the developer or owner of a website. |
These block elements identify the type of content that they contain. That's consistent with the way the HTML5 semantic elements are used.
Example
In the following example, it will create a pre block containing the JavaScript code and a blockquote for a quote and an address block to display the contact information.
<html lang="en"> <body> <h1>HTML Special Block Elements</h1> <p> The following is the JavaScript code written in pre block. </p> <pre> var today = new Date(); document.writeln( today.getFullYear() ); </pre> <p>The following is the Ernest Hemingway quote:</p> <blockquote> Cowardice, as distinguished from panic, is almost simply a lack of ability to suspend the functioning of the imagination. </blockquote> <p>Contact me <p> <address>123-456-789<br> <a href="https://www.howto-guides.com">Vinish Kapoor</a> </address> </body> </html>
Output
As shown in the featured image of this article.