What is an HTML Tag?
- HTML Tags are the basic building block of elements in HTML.
- tags start with open (< ) and closing ( > ) brackets. Inside the opening and closing brackets, we will have some content that is called an HTML element
example:
<h1>Headingh1</h1>
Commonly used tags in HTML
Document Structure Tags
<!DOCTYPE html>: Specifies the document type.<html>: Encloses the entire HTML document.<head>: Contains meta-information and links to scripts and stylesheets.<body>: Contains the content of the web page.
Metadata Tags
<title>: Sets the title of the web page.<meta>: Provides metadata such as character set, author, and viewport settings.<link>: Links external resources like stylesheets.
Text Formatting Tags
<p>: Paragraph.<h1>,<h2>,<h3>,<h4>,<h5>,<h6>: Headings.<strong>: Strong emphasis (typically bold).<em>: Emphasis (typically italic).<br>: Line break.<hr>: Horizontal rule.
List Tags
<ul>: Unordered list.<ol>: Ordered list.<li>: List item.
Hyperlink and Media Tags
<a>: Anchor (used for links).<img>: Image.<audio>: Audio content.<video>: Video content.- <figure>
- <picture>
Form Tags
<form>: Form.<input>: Input field.<textarea>: Text area.<button>: Button.<select>: Dropdown list.<option>: Options within a<select>or<datalist>.
Table Tags
<table>: Table.<tr>: Table row.<td>: Table data cell.<th>: Table header cell.<thead>: Table header group.<tbody>: Table body group.<tfoot>: Table footer group.
Semantic Tags
<header>: Header section.<footer>: Footer section.<article>: Article.<section>: Section.<nav>: Navigation.<aside>: Sidebar content.
Types of HTML tags
- Paired
- Unpaired
1. Paired Tags
- Paired tags are opening tags and closing tag is called paired tags.
Examples
- Paragraphs:
<p>This is a paragraph.</p> - Headings:
<h1>This is a heading.</h1>
2. Unpaired Tags (Self-Closing Tags or Stand-Alone Tags)
- These are tags that don't require a closing tag.
- They are self-contained, encapsulating all the information within a single tag.
- Self-Closing Tag: A self-closing tag starts with
<and ends with/>(though the/is optional in HTML5).
Examples of self-closing tags:
- Line Break:
<br/> - Horizontal Rule:
<hr/> - Image:
<img src="image.jpg" alt="An example image"/>

0 Comments:
Post a Comment
Do leave your comments