All you need to Know about HTML

All you need to Know about HTML

Jul 28, 2023ยท

6 min read

Play this article

This Blog/Documentation contains everything you need to know about HTML, Either you are a beginner starting with HTML or a Seasoned Developer, this blog got you covered๐Ÿš€โœจ

Before this Go through this Blog for VsCode Setup

Let's Begin ๐Ÿš€โœจ

What is HTML?๐ŸŒ

HTML stands for Hyper Text Markup Language, it is the standard markup language for creating Web pages.๐Ÿ“„

HTML describes the structure of a Web page HTML tells the browser how to display the content on Web page. ๐ŸŒ๐ŸŽจ

How HTML looks? ๐ŸŽจ

(This is a basic HTML Boilerplate)

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <meta http-equiv="X-UA-Compatible" content="ie=edge" />
    <title>HTML 5 Boilerplate</title>
    <link rel="stylesheet" href="style.css" />
  </head>
  <body>
    <script src="index.js"></script>
    <!--This is a comment. -->
    <h1>Jessy, Wanna Cook?๐Ÿณ</h1>
    <img
      src="https://media.vanityfair.com/photos/53f0fd829b1e228549e7ba22/1:1/w_800%2Cc_limit/you-wanna-cook-crystal-meth.gif"
      alt="Failed"
    />
  </body>
</html>

This code represents a basic HTML document that includes an external CSS file and a JavaScript file. It has the following sections:

  1. ๐Ÿ“‹<!DOCTYPE html> declares that this is an HTML5 document.

  2. ๐ŸŒThe <html> tag is the root element of the document, and the lang attribute specifies the language as "en" (English).

  3. ๐Ÿ“„The <head> section contains metadata about the document, such as character encoding, viewport settings, and the page title.

  4. ๐Ÿ”คCharacter Encoding: <meta charset="UTF-8" /> specifies that the document is encoded in UTF-8 to support various characters.

  5. ๐Ÿ–ฅ๏ธViewport Settings: <meta name="viewport" content="width=device-width, initial-scale=1.0" /> sets the initial scale and width of the page to adapt to different device screens.

  6. ๐ŸŒCompatibility: <meta http-equiv="X-UA-Compatible" content="ie=edge" /> indicates that the document should be rendered using the latest version of Internet Explorer's rendering engine.

  7. ๐Ÿ“Title: <title>HTML 5 Boilerplate</title> sets the title of the web page, which is displayed in the browser's title bar or tab.

  8. ๐ŸŽจExternal CSS: <link rel="stylesheet" href="style.css" /> links an external CSS file named "style.css" to style the content of the page.

  9. ๐Ÿ‘€Body Section: The <body> tag contains the visible content of the web page.

  10. ๐Ÿ’กJavaScript: <script src="index.js"></script> includes an external JavaScript file named "index.js" to add interactive behavior to the page.

  11. ๐Ÿ’ฌComment: <!--This is a comment. --> is an HTML comment, which won't be displayed on the web page but can be used for documenting the code.

  12. ๐Ÿ“šHeading: <h1>Jessy, Wanna Cook?</h1> displays a level 1 heading with the text "Jessy, Wanna Cook?".

  13. ๐Ÿ–ผ๏ธImage: <img src="..." alt="Failed" /> inserts an image into the page with the specified source URL and an alternative text "Failed" that will be shown if the image cannot be loaded.

Page Structure-

HTML PAGE STRUCTURE AND NESTING | QA Tech Hub


HTML Tags๐Ÿท๏ธ and Their Usage

HTML is a versatile language with a wide range of tags to structure content and create interactive web pages. Understanding these tags is essential for building well-formatted and accessible websites. Let's explore some of the most commonly used HTML tags:

1. <h1>, <h2>, ..., <h6>๐Ÿ“‘

Headings are used to create different levels of headings on a web page, with <h1> being the highest level and <h6> the lowest. They are useful for dividing content into sections and creating a hierarchical structure.

Example:

2. <p>๐Ÿ“

The <p> tag represents a paragraph of text. It is used to structure and separate blocks of text within the content.

Example:

<p>This is a paragraph of text.</p>
<p>Another paragraph here.</p>

3. <a>๐Ÿ”—

The <a> tag creates hyperlinks, allowing users to navigate to other web pages or resources. The href attribute specifies the URL of the linked page.

Example:

<a href="https://www.example.com">Visit Example Website</a>

4. <img>๐Ÿ–ผ๏ธ

The <img> tag embeds images on a web page. The src attribute specifies the image URL, and the alt attribute provides alternative text that describes the image for accessibility.

Example:

<img src="image.jpg" alt="A beautiful landscape">

5. <ul>, <ol>, and <li> ๐Ÿ“ƒ

These tags are used to create lists on a web page. <ul> represents an unordered (bullet-point) list, <ol> represents an ordered (numbered) list, and <li> defines list items.

Example:

6. <div> and <span>๐Ÿ“ฆ

The <div> tag is a block-level container used to group elements together, while the <span> tag is an inline-level container used to apply styles to specific parts of text.

Example:

7. <table>, <tr>, <th>, and <td> ๐Ÿ—ƒ๏ธ

These tags are used to create tables for organizing tabular data. <table> defines the table, <tr> represents table rows, <th> represents table headers, and <td> represents table cells.

Example:

8. <form>, <input>, and <button> ๐Ÿ“

The <form> tag is used to create interactive forms for user input. <input> elements inside the form define input fields, and <button> elements represent buttons.

Example:

9. <iframe> ๐Ÿ–ผ๏ธ

The <iframe> tag embeds an inline frame that can display content from another web page within the current page.

Example:

<iframe src="https://www.example.com"></iframe>

10. <audio>๐ŸŽต and <video>๐ŸŽฅ

These tags allow embedding audio and video content on a web page.

Example:

๐ŸŒŸOther important HTML concepts-

1. Semantic HTML๐ŸŒ:

Semantic HTML involves using tags that carry meaningful information about the structure of the content. Instead of just using generic div containers for layout, you can use semantic elements like <header>, <nav>, <main>, <section>, <article>, <footer>, etc., to give your web page a clear and meaningful structure. Semantic HTML enhances accessibility and makes it easier for search engines to understand the content.

Example:

<html>
<header>
  <h1>Website Name ๐Ÿ </h1>
  <nav>
    <ul>
      <li><a href="#home">Home ๐Ÿก</a></li>
      <li><a href="#about">About โ„น๏ธ</a></li>
      <li><a href="#contact">Contact ๐Ÿ“ž</a></li>
    </ul>
  </nav>
</header>
<main>
  <section id="about">
    <h2>About Us โ„น๏ธ</h2>
    <p>...</p>
  </section>
  <section id="contact">
    <h2>Contact Us ๐Ÿ“ž</h2>
    <p>...</p>
  </section>
</main>
<footer>
  <p>ยฉ 2023 Your Company. All rights reserved. ๐Ÿ“…</p>
</footer>
</html>

2. HTML Data Attributes๐Ÿ”:

HTML data attributes allow you to store custom data private to the page or application. They start with data- followed by your chosen attribute name. Data attributes are useful for storing additional information for JavaScript or CSS to interact with.

Example:

<div data-id="123" data-category="product">Product Card ๐Ÿ›๏ธ</div>

3. Importance of Proper HTML Usageโš™๏ธ:

Using HTML tags correctly and employing semantic elements and forms has several significant benefits:

  • Accessibility: Properly structured HTML using semantic elements improves website accessibility for people using assistive technologies, such as screen readers.

  • Search Engine Optimization (SEO): Search engines use the structure of your HTML to understand the content and relevance of your web pages, improving your website's search rankings.

  • Code Maintainability: Semantic HTML provides a more logical and organized structure, making it easier for developers to maintain and update the codebase.

  • Compatibility: Writing clean, valid HTML ensures that your website renders correctly across different browsers and devices.

  • User Experience: Well-designed forms enhance the user experience by providing clear input fields and validation messages.

4. HTML Validationโœ”๏ธ:

To ensure your HTML code is error-free and adheres to the standard syntax, you can use online validators like the W3C Markup Validation Service. These validators help identify and fix any HTML errors, leading to a more robust and reliable website.


In this blog, we covered some of the fundamental HTML tags used for structuring content and creating interactive elements on a web page. As you continue to learn HTML, remember that there are many more tags and attributes available, each serving specific purposes. With practice, you'll become more proficient in using them to build dynamic and engaging web pages.

Stay curious and keep experimenting with HTML to unleash its full potential in web development. Happy coding! ๐Ÿš€โœจ

Did you find this article valuable?

Support Aashutosh Soni by becoming a sponsor. Any amount is appreciated!

ย