Basic tags in HTML
Introduction
Welcome to our beginner-friendly guide to mastering basic HTML tags! Whether you're just starting your journey into web development or looking to refresh your knowledge, this comprehensive tutorial will walk you through essential HTML tags with clear examples.
HTML Document Structure: Let's begin with the skeleton of an HTML document. Below is a simple HTML structure:
Explanation:
<!DOCTYPE html>
: Declares the document type as HTML5.<html>
: Represents the root element of the HTML document.<head>
: Contains meta-information about the document.<title>
: Sets the title of the web page.<body>
: Contains the visible content of the web page.
Text Formatting Tags: HTML offers tags to format text in various ways. Let's see some examples:
Explanation:
<h1>
: Defines a top-level heading.<strong>
: Makes text bold.<em>
: Emphasizes text by italicizing it.<u>
: Underlines text.
Link Tags: Hyperlinks are essential for navigation. Here's how to create them:
Explanation:
<a>
: Defines a hyperlink.href
: Specifies the URL the link points to.
Image Tags: Images enhance the visual appeal of a web page. Here's how to add an image:
Explanation:
<img>
: Inserts an image.src
: Specifies the path to the image file.alt
: Provides alternative text for accessibility.
List Tags: Lists organize content in a structured manner. Let's look at examples of both unordered and ordered lists:
Explanation:
<ul>
: Defines an unordered list.<ol>
: Defines an ordered list.<li>
: Represents a list item.
Conclusion: Congratulations! You've now mastered the basic HTML tags. With these foundational elements, you're well on your way to creating engaging web pages. As you continue your learning journey, explore more HTML tags and their functionalities to unlock endless possibilities in web development. Keep practicing, and happy coding!