HTML Tags Reference With Samples and Guide
HTML Tags Reference With Samples and Guide
This document provides a reference for common HTML tags along with sample code and usage
guidance. HTML (HyperText Markup Language) is the standard markup language for creating web
pages. Each tag has a specific purpose and is used to structure content on the web.
<html>
Sample: <html>
<head>
</head>
<body>
</body>
</html>
<head>
Contains meta-information about the document. Place title and links to stylesheets here.
Sample: <head>
<title>My Page</title>
</head>
<title>
Sets the title of the document shown in the browser title bar.
<body>
Defines the body of the document. Place all visible content inside this tag.
Sample: <body>
<h1>Hello World!</h1>
</body>
<h1> to <h6>
Defines HTML headings. Use <h1> for main titles, <h2> for subtitles, down to <h6> for smaller
headings.
<h2>Subtitle</h2>
<p>
Defines a paragraph. Use this tag to group text into distinct blocks.
<br>
Inserts a single line break. Use sparingly, primarily for line breaks within text.
<hr>
Defines a thematic change in the content (a horizontal rule). Use to separate sections.
Sample: <hr>
<a>
Defines a hyperlink. Use the href attribute to link to another page or resource.
<img>
Embeds an image. Use the src attribute to specify the image path and alt for accessibility.
<div>
</div>
<span>
Defines a section in a document but does not have any specific semantic meaning. Use for styling
inline.
<ul>
Sample: <ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
<ol>
Sample: <ol>
<li>First Item</li>
<li>Second Item</li>
</ol>
<li>
Sample: <ul>
<li>List Item</li>
</ul>
<table>
Sample: <table>
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<tr>
<td>Data 1</td>
<td>Data 2</td>
</tr>
</table>
<tr>
Sample: <tr>
<td>Row Item</td>
</tr>
<th>
Sample: <th>Header</th>
<td>
Sample: <td>Data</td>
<form>
Defines an HTML form for user input. Use to collect data from users.
Sample: <form>
</form>
<input>
<textarea>
<button>
<select>
Defines a drop-down list. Use for selecting one option from multiple.
Sample: <select>
<option>Option 1</option>
</select>
<option>
Sample: <option>Option</option>
<link>
Defines the relationship between a document and an external resource. Use to link stylesheets.
<meta>
Defines metadata about an HTML document. Use for character set, viewport settings, etc.
<style>
<footer>
<header>
<nav>
<article>
<section>
<aside>
Defines content aside from the content it is placed in. Use for sidebars or related information.