0% found this document useful (0 votes)
4 views

HTML Tags Reference With Samples and Guide

Uploaded by

lesaduluthmin64
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views

HTML Tags Reference With Samples and Guide

Uploaded by

lesaduluthmin64
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

HTML Tags Reference with Samples and Basic 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>

Defines the root of an HTML document.

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.

Sample: <title>My First Web Page</title>

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

Sample: <h1>Main Title</h1>

<h2>Subtitle</h2>

<p>

Defines a paragraph. Use this tag to group text into distinct blocks.

Sample: <p>This is a paragraph.</p>

<br>

Inserts a single line break. Use sparingly, primarily for line breaks within text.

Sample: Line one.<br>Line two.

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

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

<img>

Embeds an image. Use the src attribute to specify the image path and alt for accessibility.

Sample: <img src='image.jpg' alt='Description of image'>

<div>

Defines a division or section in an HTML document. Use for grouping elements.


Sample: <div>

<p>Content goes here.</p>

</div>

<span>

Defines a section in a document but does not have any specific semantic meaning. Use for styling

inline.

Sample: <span style='color: red;'>Red Text</span>

<ul>

Defines an unordered list. Use for bullet points.

Sample: <ul>

<li>Item 1</li>

<li>Item 2</li>

</ul>

<ol>

Defines an ordered list. Use for numbered lists.

Sample: <ol>

<li>First Item</li>

<li>Second Item</li>

</ol>

<li>

Defines a list item. Use within <ul> or <ol>.

Sample: <ul>

<li>List Item</li>

</ul>
<table>

Defines a table. Use to display tabular data.

Sample: <table>

<tr>

<th>Header 1</th>

<th>Header 2</th>

</tr>

<tr>

<td>Data 1</td>

<td>Data 2</td>

</tr>

</table>

<tr>

Defines a row in a table. Use within a <table>.

Sample: <tr>

<td>Row Item</td>

</tr>

<th>

Defines a header cell in a table. Use for column titles.

Sample: <th>Header</th>

<td>

Defines a standard cell in a table. Use to display data.

Sample: <td>Data</td>

<form>

Defines an HTML form for user input. Use to collect data from users.
Sample: <form>

<input type='text' name='name'>

</form>

<input>

Defines an input control. Use for user input fields.

Sample: <input type='text' placeholder='Enter text'>

<textarea>

Defines a multi-line input control. Use for larger text input.

Sample: <textarea rows='4' cols='50'></textarea>

<button>

Defines a clickable button. Use for submitting forms or triggering actions.

Sample: <button>Click Me</button>

<select>

Defines a drop-down list. Use for selecting one option from multiple.

Sample: <select>

<option>Option 1</option>

</select>

<option>

Defines an option in a drop-down list. Use within <select>.

Sample: <option>Option</option>

<link>

Defines the relationship between a document and an external resource. Use to link stylesheets.

Sample: <link rel='stylesheet' href='styles.css'>


<script>

Defines a client-side script. Use to embed JavaScript.

Sample: <script src='script.js'></script>

<meta>

Defines metadata about an HTML document. Use for character set, viewport settings, etc.

Sample: <meta charset='UTF-8'>

<style>

Defines style information for a document. Use for internal CSS.

Sample: <style>body { font-family: Arial; }</style>

<footer>

Defines a footer for a document or section. Use for closing content.

Sample: <footer>Footer Content</footer>

<header>

Defines a header for a document or section. Use for introductory content.

Sample: <header>Header Content</header>

<nav>

Defines navigation links. Use to create menus.

Sample: <nav><a href='#'>Home</a></nav>

<article>

Defines an independent piece of content. Use for self-contained articles.

Sample: <article><h2>Article Title</h2></article>

<section>

Defines a section in a document. Use for thematic grouping of content.


Sample: <section><h2>Section Title</h2></section>

<aside>

Defines content aside from the content it is placed in. Use for sidebars or related information.

Sample: <aside>Related Links</aside>

You might also like