Free HTML course. Sign Up for tracking progress →

HTML: Headings

The larger the text, the more often it is divided into logical sections. For example, the basic markup of a report, diploma or essay consists of three main parts:

  1. Introduction
  2. Main part
  3. Conclusion

Such logical divisions into headings allow you to navigate faster in the document and find the part you need.

To create titles used 6 paired tags: <h1>, <h2>, <h3>, <h4>, <h5>, <h6>, where <h1> — title of the first level, the most important and describes the main subject of the text, and <h6> — the title of the lowest level.

<h1>Title of the first level</h1>
<h2>Title of the second level</h2>
<h3>Title of the third level</h3>
<h4>Title of the fourth level</h4>
<h5>Title of the fifth level</h5>
<h6>Title of the sixth level</h6>

Title of the first level

Title of the second level

Title of the third level

Title of the fourth level

Title of the fifth level
Title of the sixth level

Each lower level heading is a subsection of a higher level heading. This is very similar to the table of contents of any book, the structure of which might look like this:

  • Chapter 1
    • Part 1
    • Part 2
    • Notes
    • Part 3
  • Chapter 2
<h1>The best book on earth</h1>
<p>Description of the book. Thanks to my cat and my two dogs. Meow!</p>

<h2>Chapter 1</h2>

<h3>Part 1</h3>
<p>Paragraph with text</p>
<p>Paragraph with text</p>

<h3>Part 2</h3>
<p>Paragraph with text</p>
<p>Paragraph with text</p>
<h4>Notes</h4>
<p>The text of this note is written with love</p>

<h3>Part 3</h3>
<p>Paragraph with text</p>
<p>Paragraph with text</p>

<h2>Chapter 2</h2>

Instructions

Add a first and second level header with arbitrary text in the editor

The exercise doesn't pass checking. What to do? 😶

If you've reached a deadlock it's time to ask your question in the «Discussions». How ask a question correctly:

  • Be sure to attach the test output, without it it's almost impossible to figure out what went wrong, even if you show your code. It's complicated for developers to execute code in their heads, but having a mistake before their eyes most probably will be helpful.
In my environment the code works, but not here 🤨

Tests are designed so that they test the solution in different ways and against different data. Often the solution works with one kind of input data but doesn't work with others. Check the «Tests» tab to figure this out, you can find hints at the error output.

My code is different from the teacher's one 🤔

It's fine. 🙆 One task in programming can be solved in many different ways. If your code passed all tests, it complies with the task conditions.

In some rare cases, the solution may be adjusted to the tests, but this can be seen immediately.

I've read the lessons but nothing is clear 🙄

It's hard to make educational materials that will suit everyone. We do our best but there is always something to improve. If you see a material that is not clear to you, describe the problem in “Discussions”. It will be great if you'll write unclear points in the question form. Usually, we need a few days for corrections.

By the way, you can participate in courses improvement. There is a link below to the lessons course code which you can edit right in your browser.

Tips

  • Follow the sequence of headings. Don't skip levels

  • There is usually only one first level header on the page


If you got stuck and don't know what to do, you can ask a question in our huge and friendly community