About Lesson
HTML Headings
HTML headings are used to define the hierarchy and structure of content on a web page. There are six levels of headings, from <h1>
to <h6>
.
Basic Structure of HTML Headings
An HTML heading is defined with the <h1>
to <h6>
tags:
Example of HTML headings:
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<h3>Heading 3</h3>
<h4>Heading 4</h4>
<h5>Heading 5</h5>
<h6>Heading 6</h6>
Usage of HTML Headings
Headings should be used to provide a hierarchical structure to your content. Typically, <h1>
is used for the main heading of a page, followed by <h2>
, <h3>
, and so on to denote subheadings.
Example: Structuring a Web Page with Headings
Example of using headings in a web page:
<h1>Main Heading</h1>
<h2>Section 1</h2>
<p>Content of section 1...</p>
<h3>Subsection 1.1</h3>
<p>Content of subsection 1.1...</p>
<h2>Section 2</h2>
<p>Content of section 2...</p>
Conclusion
HTML headings are fundamental for organizing and structuring web page content. By using headings correctly, you can improve accessibility, readability, and SEO (Search Engine Optimization) of your web pages.