04HTML basics
HTML and Text Formatting
Easy20MIN
The appearance of an HTML document is mainly formatted with CSS styles, which we will delve into in the next section of the course. However, HTML has different elements that have a default appearance and can also be used for text formatting.
These elements can be used to create, for example, headings (<h1>, <h2>, <h3>), paragraphs (<p>), bold text (<b>), italic text (<i>), underlined text (<u>), smaller text (<small>), larger text (<big>), subscript text (<sub>), superscript text (<sup>), line breaks (<br>), horizontal rules (<hr>), preformatted text (<pre>), code examples (<code>), and block quotes (<blockquote>).
Example
HTML
1<!DOCTYPE html><html><head><title>An example of text formatting</title></head><body><h1> Title 1</h1><h2> Title 2</h2><h3> Title 3</h3><p> This is the text of the song.</p> <b>This text is in bold.</b> <i>This text is italicized.</i> <u>This text is underlined.</u> <small>This text is in a smaller size.</small> <big>This text is in a larger size.</big> <sub>This text is subscripted.</sub> <sup>This text is superscripted.</sup><br><hr><pre> This text preserves spaces and line breaks.</pre> <code>Tämä teksti on koodiesimerkki.</code><blockquote> This text is enclosed in quotation marks.</blockquote></body></html>1 / 3
Hakatemia Pro
Learn to hack — start here
Hundreds of interactive courses, virtual labs and CTF challenges in your browser. Start a free trial — no card required.