HTML TAGS

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 5

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.

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

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.

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

9. <ul>, <ol>, and <li>

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.

<span class="highlight">Highlighted text</span>

12. <form>
Defines an HTML form for user input.

<form action="/submit-form" method="post">


<!-- Form elements go here -->
</form>

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.

<button type="button">Click Me!</button>

15. <table>, <tr>, <th>, and <td>

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.

<link rel="stylesheet" href="styles.css">

18. <script>
Used to embed or reference JavaScript code.

<script src="script.js"></script>

19. <header>, <nav>, <main>, <section>, <article>, <aside>, and


<footer>
Semantic elements that define different parts of a web page.

<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>

You might also like