Forum digitalis

1.3 Text and content

Headings

HTML provides six levels of headings: <h1> through <h6>. They structure content hierarchically, from the most important to the least, aiding readability and semantic markup.

Text

Paragraphs are marked with <p>. Line breaks use <br>, and thematic breaks use <hr>. These elements structure running text and improve readability.

Emphasis

HTML provides various elements for emphasis and special formatting: <strong> for important content, <em> for emphasized content, <code> for code snippets, <pre> for preformatted text, and <mark> to highlight text.

Example

The following is an example using the previously mentioned tags.

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Example: Text & Headings</title> </head> <body> <h1>This is an H1 heading</h1> <h2>This is an H2 heading</h2> <p>This is a paragraph with normal text.</p> <p>Here is a line break<br>directly after.</p> <hr> <strong>This is important text</strong> <em>This is emphasized text</em> <code>ExampleCode()</code> <pre>Preformatted text</pre> <mark>Highlighted text</mark> </body> </html>