coding180 icon
Coding180
HTML Heading Titles: <h1><h2><h3><h4><h5><h6>

HTML Heading Titles: <h1><h2><h3><h4><h5><h6>

Home > Tutorials > HTML > HTML Elements


To declare a title in an HTML document, we use the title elements: 

  1. <h1>
  2. <h2>
  3. <h3>
  4. <h4>
  5. <h5>
  6. <h6>

The highest level title is <h1>, the one with the larger font size.

The browser is responsible for defining the font size, later in this lesson you will see how to modify the font, size, color etc. using the CSS language.

Depending on the importance of the title, we will use one of these HTML elements. It requires the closing mark of the title with the backslash, as we have seen.

The search engines like Google, Bing, Yahoo etc. uses this titles elements to identify the topic of a webpage. 

Do not confuse the title of the page that goes in the <head> section with the h1, h2, h3 etc. tags.

We will make a page that contains a first level heading <h1> and then two level headings <h2>. We will define a paragraph for each second level heading.

<!DOCTYPEhtml>
    <html>

    <head>
        <title>Page title</title>
        <meta charset="UTF-8">
    </head>

    <body>
        <h1>Data types in MySQL</h1>
        <h2>varchar</h2>
        <p>
            is used to store character strings. A string
 is a sequence of characters.
            It is placed between (single) quotation marks: 'Hello'.<br>
            The "varchar" type defines a variable-length string on
 which we determine the maximum
            of characters. You can save up to 255
            characters. To store strings of up to 30 characters, 
we define a field of type varchar(30).
        </p>
        <h2>int</h2>
        <p>
            It is used to store integer numeric values,
 from -2000000000 to approximately 2000000000.<br>
            We define fields of this type when we want to 
represent, for example, quantities.
        </p>
    </body>

    </html>

Output: 

Each title always appears on a different line, it does not matter if we type it in a row in the file, that is, the result will be the same if we do:

<h1>Data types in MySQL</h1>
<h2>varchar</h2>

or this:

<h1>Data types in MySQL</h1><h2>varchar</h2>

The browser prints each title on a new line.

Note: HTML is not responsible for indicating the size of fonts. The browser will define the font size according to the title level that we specified. The largest size is level 1 <h1>.

<h1> comes from the word heading

Tips to remember this tag:

h means heading


user

Robort Gabriel

Lagos, Nigeria

Freelance Web Developer, Native Android Developer, and Coding Tutor.

Skills
  • UI / UX
  • JavaScript
  • Python
  • PHP
  • Kotlin
  • Java
  • Bootrap
  • Android
  • Laravel