Each open <h1> tag has to be closed with </h1>.The content of the title goes between these codes.
<h1> This is a heading </h1> <h2> This is a second-order heading </h2> <h3> This is a third-order heading </h3>
Heading tags have a particularly important function within an HTML structure. An HTML file can be understood as a combination of nodes, whereby the heading tag is the starting point from which other nodes, in other words, content or other headings, branch out. An HTML file should therefore only have exactly one H1 heading, a rule that you should definitely heed, even if it is allowed in principle to use multiple H1 tags. This is a question of good style. Lower-order headers can be used as often as desired, but should be chosen in such a way that there is an understandable hierarchy. A major heading with two sub-items would look like this:
<h1> This is a heading </h1> <h2> This is a second-order heading </h2> <h2> This is a second-order heading <h2>
Heading tags provide an HTML file structure and specify what type of data the browser should display. How the data is to be displayed, is not yet determined, although this is usually predefined for headings. The formatting of headings should be specified in the CSS files to separate formatting and content. However, the use of heading tags is a must if you want to display text content. Each HTML file should have only one start node, if it is to be valid. The W3C Validator can be used to check the validity of an HTML document.  Furthermore, a well-structured HTML file offers certain advantages for users and search engines.
1.) Headings can be interpreted by browsers, which may not be able to recognize or display the custom style sheets.
2.) Screen readers and magnifiers refer to headers (accessibility and display on mobile devices).
3.) A clear structure is given: The user receives instructions concerning the content and can decide which paragraphs are of interest to him.
4.) Search Engines obtain valid source code and other signals in the form of relevant keywords from headings that summarize the content.
5.) Global changes to all headers can be done easily: Only a small change to the CSS file is required and all headings receive formatting instructions.
The heading tag is of central importance for search engines. Search engines use heading tags to identify keywords that stand out from the remaining content by their formatting. Usually a heading briefly states what the subsequent text section is all about. It is therefore highly recommended to use important keywords already in the heading. The higher the position of a heading on a page, the more important it is. However, it is not useful to load up a heading with too many keywords. The keywords should have a direct relation to the content and fit into a readable sentence structure. Randomly stuffing keywords in the heading tags does not help search engines or users.
The importance of the heading tag is expressed by “n” (H1 very important H6 less important). There are some theories in on-page optimization specifying that the H2 headings should have special emphasis and that important keywords should be placed in them because the actual text content of a website is structured with these headings. At the same time, it is important that signals get sent to search engines through headings. So it should be well-balanced taking into account user needs and also complying with the requirements of search engine optimization.