A Comprehensive Overview of Basic HTML Tags

A Comprehensive Overview of Basic HTML Tags

Introduction to HTML

HTML (HyperText Markup Language) is the standard markup language used to create web pages. It provides the structure for content on the web, allowing developers to format text, embed images, and create hyperlinks.

Key Concepts

  • Tags: HTML uses tags to define different elements on a web page. Tags are enclosed in angle brackets (<>).
  • Elements: An element consists of a start tag, content, and an end tag. For example:
<p>This is a paragraph.</p>

Common HTML Tags

1. <html>

  • Purpose: The root element of an HTML page.

Example:

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

2. <head>

  • Purpose: Contains meta-information about the document, such as the title and links to stylesheets.

Example:

<head>
    <title>My Web Page</title>
</head>

3. <title>

  • Purpose: Sets the title of the web page, shown in the browser tab.

Example:

<title>Welcome to My Site</title>

4. <body>

  • Purpose: Contains the content of the web page, such as text, images, and links.

Example:

<body>
    <h1>Hello, World!</h1>
</body>

5. <h1> to <h6>

  • Purpose: Headings of different levels, with <h1> being the highest and <h6> the lowest.

Example:

<h1>Main Title</h1>
<h2>Sub Title</h2>

6. <p>

  • Purpose: Defines a paragraph.

Example:

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

7. <a>

  • Purpose: Defines a hyperlink.

Example:

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

8. <img>

  • Purpose: Embeds an image in the page.

Example:

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

Conclusion

Understanding these basic HTML tags is essential for creating and structuring web content. HTML forms the backbone of web development, and mastering it is the first step towards building your own web pages.