Tuesday 14 March 2023

HTML Headings

HTML headings are used to create a hierarchical structure of content on a web page. There are six levels of headings, ranging from H1 (the most important) to H6 (the least important). Here are the headings and some real-time examples for each one:

  1. H1 - This is the main heading on the page and should be used only once. It should summarize the main content of the page. For example:
<h1>Welcome to my Blog</h1>
  1. H2 - This heading is used to introduce the main sections of the page. It should be used to divide the content of the page into meaningful chunks. For example:
<h2>About Me</h2>
  1. H3 - This heading is used to introduce sub-sections within the main sections of the page. For example:
<h3>Education</h3>
  1. H4 - This heading is used to introduce sub-sections within H3 sections. For example:
<h4>Undergraduate Studies</h4>
  1. H5 - This heading is used to introduce sub-sections within H4 sections. For example:
<h5>Elective Courses</h5>
  1. H6 - This heading is used to introduce sub-sections within H5 sections. For example:
<h6>History of Art</h6>
HTML code for Headings:
<!DOCTYPE html>
<html>
<head>
<title>HTML Headings</title>
</head>
<body>
<h1>Welcome to my Blog</h1>
<h2>About Me</h2>
<h3>Education</h3>
<h4>Undergraduate Studies</h4>
<h5>Elective Courses</h5>
<h6>History of Art</h6>
</body>
</html>

Output:



It's important to use HTML headings in a logical and hierarchical order. By using headings appropriately, you can help search engines understand the structure and content of your web page, which can improve its accessibility and search engine ranking.

Practice Time!

  1. Write the HTML code for an H1 heading that says "Welcome to my Website".
  2. Write the HTML code for an H2 heading that says "About Us".
  3. Write the HTML code for an H3 heading that says "Our Services".
  4. Write the HTML code for an H4 heading that says "Web Development".
  5. Write the HTML code for an H5 heading that says "Front-end Development".
  6. Write the HTML code for an H6 heading that says "JavaScript Frameworks".
  7. True or False: It is acceptable to use multiple H1 headings on a single web page.

Answers
  1. Write the HTML code for an H1 heading that says "Welcome to my Website".

    • Answer: <h1>Welcome to my Website</h1>
  2. Write the HTML code for an H2 heading that says "About Us".

    • Answer: <h2>About Us</h2>
  3. Write the HTML code for an H3 heading that says "Our Services".

    • Answer: <h3>Our Services</h3>
  4. Write the HTML code for an H4 heading that says "Web Development".

    • Answer: <h4>Web Development</h4>
  5. Write the HTML code for an H5 heading that says "Front-end Development".

    • Answer: <h5>Front-end Development</h5>
  6. Write the HTML code for an H6 heading that says "JavaScript Frameworks".

    • Answer: <h6>JavaScript Frameworks</h6>
  7. True or False: It is acceptable to use multiple H1 headings on a single web page.

    • Answer: False.

    No comments:

    Post a Comment

    HTML Text Formatting

    <i> - This tag is used to italicize text, meaning the text enclosed within <i> tags will be rendered in italic font style. How...