HTML Text & Formatting
HTML Headings
HTML provides six levels of headings, from <h1>
(most important) to <h6>
(least important).
These are used to define the structure and importance of content on the page.
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
HTML Paragraphs
The <p>
tag is used to define paragraphs. Browsers automatically add space before and after a paragraph.
<p>This is the first paragraph of text.</p>
<p>This is the second paragraph of text.</p>
HTML Line Breaks and Horizontal Rules
Use <br>
for a line break inside a paragraph or any other block, and <hr>
for a horizontal line to separate sections.
<p>
This is line one.<br>
This is line two with a line break.
</p>
<hr>
<p>This is a new section below a horizontal rule.</p>
HTML Text Formatting Tags
HTML provides various tags to style or emphasize parts of text.
<b>
– Bold text (no semantic importance)<strong>
– Important text (semantically strong)<i>
– Italic text (no semantic importance)<em>
– Emphasized text (semantically emphasized)<mark>
– Highlighted/marked text<small>
– Smaller text<del>
– Deleted text (strikethrough)<ins>
– Inserted text (underline)<sub>
– Subscript text<sup>
– Superscript text
<p><b>Bold text</b> and <strong>important text</strong></p>
<p><i>Italic text</i> and <em>emphasized text</em></p>
<p><mark>Highlighted text</mark> and <small>smaller text</small></p>
<p><del>Deleted text</del> and <ins>inserted text</ins></p>
<p>H<sub>2</sub>O and E = mc<sup>2</sup></p>
HTML Quotations and Citations
HTML offers special tags to represent quotes and citations:
<blockquote>
– For long quotations, typically displayed with indentation<q>
– For short, inline quotes<cite>
– For citing sources or references<abbr>
– For abbreviations with tooltips<address>
– For contact information or authorship
<blockquote>
The greatest glory in living lies not in never falling, but in rising every time we fall.
</blockquote>
<p>As Nelson Mandela said, <q>It always seems impossible until it's done.</q></p>
<p>Source: <cite>Nelson Mandela Biography</cite></p>
<p><abbr title="World Health Organization">WHO</abbr> was founded in 1948.</p>
<address>
Written by John Doe.<br>
Visit us at: www.example.com<br>
City, Country
</address>
HTML Comments
Comments are not displayed in the browser but help developers understand the code. You can use them to describe sections or temporarily disable code.
<!-- This is a single-line comment -->
<p>This is visible text.</p>
<!--
This is a multi-line comment.
It will not appear in the browser.
-->
Conclusion
Understanding how to structure and format text is essential in HTML. From headings to paragraphs, formatting tags to quotations, and comments — these elements ensure content is well-organized and accessible.
In the next chapter, we’ll learn about HTML Links and Anchors to connect your pages and create interactive navigation.
If you have any questions, feel free to ask. Thank you for reading!
If you have any query or question, please contact through below form. Our team will be in touch with you soon.
Please provide your valueable feedback or suggession as well.