Headings (h1-h6)
Hello, students! In this lesson, we will learn about HTML headers.
Headers are HTML elements used to divide the content of a web page into sections.
Headers are identified by tags with the prefix h
.
The level of the header is indicated by the number following the prefix.
For example, the <h1>
tag represents a level 1 header, the <h2>
tag represents a level 2 header, and so on.
Topics
- What are HTML headers?
- Header levels
- Code examples
What are HTML headers?
Headers are HTML elements used to divide the content of a web page into sections.
Headers are used to organize the content of the page and to emphasize important information.
Header levels
There are six levels of headers, identified by the following numbers:
- Level 1: The main title of the page
- Level 2: A main subtitle
- Level 3: A smaller subtitle
- Level 4: An even smaller subtitle
- Level 5: A less important subtitle
- Level 6: An even less important subtitle
The higher the level number, the less important the header.
Code examples
Here are some code examples for headers:
<h1>This is a level 1 title</h1> <h2>This is a level 2 title</h2> <h3>This is a level 3 title</h3> <h4>This is a level 4 title</h4> <h5>This is a level 5 title</h5> <h6>This is a level 6 title</h6>
Note that the browser displays headers with a larger and bold font, making them more visible.
Exercises
- Create an HTML document with a level 1 title, a level 2 title, and a level 3 title.
- Save the document and open it in a browser.
Observe how the browser displays the headers.
Good luck!
Conclusion
Headers are an important tool for organizing and emphasizing the content of a web page.
Understanding how to use them correctly is essential for creating effective web pages.