Which of the following is not a valid HTML tag: h1, H, h2, h3?


HTML, hypertext markup language, is filled with tags, elements and attributes and it can be a little confusing to use them. Thus to find the valid HTML tags out of the lot, let’s understand the concepts of HTML, HTML syntax, tags. Then we also look into the output of each of these tags.

HTML

The foundation of a web page is HTML, which offers a uniform method for organizing and displaying content online. Only HTML codes are used to create static web pages with readable, resourceful, and accessible content. Using tags and attributes, HTML adheres to a specific syntax. To master the language of web development, one must be acquainted with the fundamentals of HTML. To understand the basics of tags and their purpose, let’s move on to the new section.

HTML tags

HTML documents are simply text files with the.html or.htm extension. A string of tags is enclosed between angle brackets (>). Tags define elements and their attributes. A doctype declaration and the tag that encloses the entire document are typically placed at the start of an HTML document. The tag contains meta-information about the file, such as the title and character encoding. The webpage's visible content is contained in the tag. There are numerous other tags that can be used to display in that format, including head, body, paragraph, image, and many others.

Numerous attributes of HTML tags enable web designers to produce structured, interactive, and aesthetically pleasing web content. Among the essential attributes of HTML tags are −

  • Structure − The structural framework for arranging content on a webpage is provided by HTML tags. Tags enable us to divide content into meaningful sections, improving readability and maintainability.

  • Semantic Meaning − Numerous HTML tags have semantic meaning, which gives web browsers and assistive technologies more context. Semantic tags aid in communicating the function and role of the content, improving both user and search engine accessibility.

  • Content Presentation − The headings, paragraphs, lists, and other content elements that help organize and present the textual and multimedia content on a webpage are defined using HTML tags.

  • Linking − The tag is used to make links that let users jump to other web pages, outside resources, or various parts of the same page.

  • Media Embedding − HTML tags for "img", "audio," and "video" allow users to insert images, audio files, and video content into web pages.

Types of Tags and Their Uses

  • Headings(h1 to h6) − To define headings, you can use h tags, which have different levels, each representing different sizes of heading. They serve to organize the content and denote the order of importance of the information on the page.

  • Paragraph tags − These tags are used to identify text paragraphs. It adds a new line before and after the paragraph and groups together text that is related.

  • Anchor Tags − This tag is used to link other web pages to your file, The url needs to be mentioned in the src attribute.

  • List tags − This tag is used to make lists, both ordered and unordered.

  • Division tags − This tag is used to create a generic container to group certain elements, this can later be used to style.

Heading Tags

  • <h1> (heading level 1 tag) − The page's primary heading is represented by this tag, the highest level heading. To describe the main topic or title, it should ideally only be used once per page.

  • <h2>(heading level 2 tag) − Subheadings that are marginally less significant than the main heading are designated with the h2> tag. It denotes the start of a new section or a significant subsection.

  • <h3> (heading level 3 tag) − This tag is applied to sub-subheadings to further categorize the information under the heading. It is a more compact section of the page.

  • <h4> (heading level 4 tag) − This is employed for headings with even lower priority, further dividing the content.

  • <h5> (heading level 5 tag) − This tag is used for headings that have less importance and are nested within sections to further organize the content. Comparatively speaking, it is not as frequently used as other heading levels.

  • <h6> (heading level 6 tag) − This tag is the smallest heading and is used for subsections or smaller headings within larger headings. It is the least frequent level of heading.

Sample Code

Algorithm

  • Open a HTML file and save it with the .html section.

  • Write code for each and every heading tag.

  • Save the file and view it in your browser.

Example

<!DOCTYPE html>
<html>
<head>
   <title>Coding with HTML</title>
</head>
<body>
   <H1>This is H1 heading</H1>
   <h2>This is H2 heading</h2>
   <h3>This is H3 heading</h3>
   <h4>This is H4 heading</h4>
   <h5>This is H5 heading</h5>
   <h6>This is H6 heading</h6>
</body>
</html>

Conclusion

Concludingly, HTML has a high number of tags which can cause confusion as to the purpose of each one of them. Thus paying attention to the use of tags and their syntax is very important. Practicing the codes and experimenting with tags can help you get a better grip of HTML as language, and will allow you to stay clear about tags and syntax.

With enough practice and knowledge of HTML, you can be much clear about syntax, and how to write it. Coming to the answer,the <H> tag is invalid out of the lot and all the other tags, <h1>,<h2>,<h3> are valid and are different level headings.

Updated on: 22-Aug-2023

132 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements