A Comprehensive Guide to HTML Tags

 

A Comprehensive Guide to HTML Tags

HTML (Hypertext Markup Language) is the backbone of web development, allowing developers to structure content on the web. HTML tags play a crucial role in this process by defining different elements on a webpage. In this blog post, we'll explore some essential HTML tags along with examples to help you understand their usage.

1. <!DOCTYPE html>

This declaration specifies the HTML version being used. It must be included at the beginning of an HTML document.


Check This

<!DOCTYPE html>
<html>
  <head>
    <title>My Webpage</title>
  </head>
  <body>
    <!-- Content goes here -->
  </body>
</html>

2.<html>

The root element of an HTML document.


<html>
  <!-- Content goes here -->
</html>


<html>
  <!-- Content goes here -->
</html>

3. <head>

Contains meta-information about the HTML document, such as the title, character set, and linked stylesheets.


<head>
  <title>My Webpage</title>
  <meta charset="UTF-8">
  <link rel="stylesheet" href="styles.css">
</head>

4. <title>

Sets the title of the HTML document, which appears in the browser's title bar or tab.


<title>My Webpage</title>

5. <body>

Encloses the content of the HTML document.


<body>
  <h1>Hello, World!</h1>
  <p>This is a sample webpage.</p>
</body>

6. Heading Tags (<h1> to <h6>)

Used to define headings, where <h1> is the largest and <h6> is the smallest.


<h1>Main Heading</h1>
<h2>Subheading 1</h2>
<h3>Subheading 2</h3>

7. <p>

Defines a paragraph of text.

<p>This is a sample paragraph.</p>

8. <a>

Creates a hyperlink.


<a href="https://www.example.com">Visit our website</a>

9. <img>

Embeds an image into the document.


<img src="image.jpg" alt="Description of the image">

10. <ul> and <li>

Creates an unordered list and list items.


<ul>
  <li>Item 1</li>
  <li>Item 2</li>
</ul>

11. <ol> and <li>

Creates an ordered list and list items.


<ol>
  <li>First item</li>
  <li>Second item</li>
</ol>

12. <table>, <tr>, <td>

Defines a table, table row, and table data.


<table>
  <tr>
    <td>Row 1, Cell 1</td>
    <td>Row 1, Cell 2</td>
  </tr>
  <tr>
    <td>Row 2, Cell 1</td>
    <td>Row 2, Cell 2</td>
  </tr>
</table>

These are just a few of the many HTML tags available for structuring web content. As you continue your journey in web development, exploring and understanding the purpose of each tag will be crucial. Happy coding!

Post a Comment

0 Comments