HTML Tags
HTML (HyperText Markup Language) is used to create and design web pages. It consists of various tags that define the structure and content of a webpage. Here’s a basic rundown of some common HTML tags and their purposes:
Basic Tags
-
<!DOCTYPE html>- Declares the document type and version of HTML.
- Always the first line in an HTML document.
-
<html>- The root element of an HTML document.
- Contains all other HTML elements.
-
<head>- Contains meta-information about the document, such as its title and links to stylesheets.
-
<title>- Sets the title of the document, which appears in the browser’s title bar or tab.
-
<meta>- Provides meta-information like character set, author, and viewport settings.
- Example:
<meta charset="UTF-8">
-
<link>- Links to external resources, such as stylesheets.
- Example:
<link rel="stylesheet" href="styles.css">
-
<script>- Used to define client-side JavaScript.
- Example:
<script src="script.js"></script>
-
<body>- Contains the content of the document that is visible to the user.
Structural Tags
-
<header>- Represents introductory content or navigational links.
-
<nav>- Defines a navigation section with links to other parts of the website.
-
<main>- Represents the dominant content of the document.
-
<section>- Defines a section in a document. Often used for grouping related content.
-
<article>- Represents a self-contained piece of content, like a blog post or news article.
-
<aside>- Represents content indirectly related to the main content, like a sidebar or a pull quote.
-
<footer>- Represents the footer of a document or section, typically containing author information, copyright, or contact details.
Text Formatting Tags
-
<h1>to<h6>- Defines headings,
<h1>is the largest, and<h6>is the smallest.
- Defines headings,
-
<p>- Represents a paragraph.
-
<strong>- Indicates strong importance, typically displayed as bold text.
-
<em>- Indicates emphasized text, typically displayed as italic.
-
<a>- Defines a hyperlink. Use the
hrefattribute to specify the URL. - Example:
<a href="https://example.com">Link Text</a>
- Defines a hyperlink. Use the
-
<br>- Inserts a line break.
-
<hr>- Represents a thematic break or horizontal line.
List Tags
-
<ul>- Defines an unordered list.
<li>is used to define each list item.
-
<ol>- Defines an ordered list.
<li>is used to define each list item.
-
<dl>- Defines a description list.
<dt>is used for the term, and<dd>is used for the description.
Table Tags
-
<table>- Defines a table.
-
<tr>- Defines a table row.
-
<td>- Defines a table data cell.
-
<th>- Defines a table header cell.
-
<caption>- Defines a table caption.
Form Tags
-
<form>- Defines an HTML form for user input.
-
<input>- Defines an input field. The
typeattribute specifies the input type (e.g., text, password, submit).
- Defines an input field. The
-
<textarea>- Defines a multiline text input field.
-
<button>- Defines a clickable button.
-
<select>- Defines a drop-down list.
-
<option>- Defines options in a drop-down list.
-
<label>- Defines a label for an
<input>element.
- Defines a label for an
This is just a basic overview; there are many more tags and attributes to explore as you dive deeper into HTML.
0
likes
Your Feedback
Help us improve by sharing your thoughts
Online Learner helps developers master programming, database concepts, interview preparation, and real-world implementation through structured learning paths.
Quick Links
© 2023 - 2026 OnlineLearner.in | All Rights Reserved.
