HTML Tags
HTML Tags
Here are some of the most important HTML tags that every web developer should know:
1. <!DOCTYPE html>
Defines the document type and version of HTML. It should be the very first line in an HTML
document.
<!DOCTYPE html>
2. <html>
The root element of an HTML document. All other elements must be nested inside this tag.
<html lang="en">
<!-- Content goes here -->
</html>
3. <head>
Contains meta-information about the document, such as the title, character set, and links to
stylesheets and scripts.
<head>
<meta charset="UTF-8">
<title>Document Title</title>
<link rel="stylesheet" href="styles.css">
</head>
4. <body>
Contains the content of the HTML document, such as text, images, and other media.
<body>
<!-- Content goes here -->
</body>
5. <h1> to <h6>
Heading tags, with <h1> being the highest (or most important) level and <h6> the lowest. Used
to define headings and subheadings.
<h1>Main Heading</h1>
<h2>Subheading</h2>
<h3>Sub-subheading</h3>
6. <p>
Defines a paragraph.
<p>This is a paragraph.</p>
7. <a>
Defines a hyperlink, used to link from one page to another.
8. <img>
Embeds an image in the document. The src attribute specifies the path to the image file, and
the alt attribute provides alternative text.
Define unordered lists (<ul>) and ordered lists (<ol>), with list items (<li>).
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
<ol>
<li>First item</li>
<li>Second item</li>
</ol>
10. <div>
Defines a division or a section in an HTML document, often used as a container for other
elements to apply CSS styles.
<div class="container">
<!-- Content goes here -->
</div>
11. <span>
An inline container used to mark up a part of a text or a document, often used to apply styles or
JavaScript to a portion of text.
12. <form>
Defines an HTML form for user input.
13. <input>
Defines an input field within a form. The type attribute specifies the type of input.
<input type="text" name="username">
<input type="password" name="password">
<input type="submit" value="Submit">
14. <button>
Defines a clickable button.
Define a table (<table>), table rows (<tr>), table headers (<th>), and table data cells (<td>).
<table>
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<tr>
<td>Data 1</td>
<td>Data 2</td>
</tr>
</table>
16. <meta>
Defines metadata about the HTML document, such as character set, viewport settings, and
search engine keywords.
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
17. <link>
Used to link to external resources, like stylesheets.
18. <script>
Used to embed or reference JavaScript code.
<script src="script.js"></script>
<header>Header content</header>
<nav>Navigation links</nav>
<main>Main content</main>
<section>Section content</section>
<article>Article content</article>
<aside>Sidebar content</aside>
<footer>Footer content</footer>