π <html> Tag
π The <html>
tag represents the root element of an HTML document. All other tags must be nested inside it.
<!DOCTYPE html> <html lang="en"> <head></head> <body></body> </html>
- π― Why use: It defines the start and end of an HTML document.
- π SEO Benefit: Correct usage helps browsers and crawlers understand document structure.
- π Other: The
lang
attribute improves accessibility and SEO by specifying language.
π§ <head> Tag
π The <head>
tag contains metadata such as title, meta descriptions, styles, and scripts.
<head> <title>My Website</title> <meta charset="UTF-8"> </head>
- π― Why use: To provide essential information about the document.
- π SEO Benefit: Houses
<title>
and <meta>
, critical for SEO rankings. - π Other: Scripts and CSS links often go inside
<head>
.
π·οΈ <title> Tag
π Defines the title of a webpage, shown in browser tabs and search engine results.
<title>HTML Tags Guide</title>
- π― Why use: Helps identify the page content quickly.
- π SEO Benefit: One of the most important on-page SEO elements.
- π Other: Keep under 60 characters for best SEO performance.
βοΈ <meta> Tag
π Provides metadata like description, charset, viewport settings, and keywords.
<meta name="description" content="Learn HTML tags">
- π― Why use: Gives search engines and browsers important info.
- π SEO Benefit:
description
meta impacts CTR from search results. - π Other: Use
viewport
meta for responsive design.
π <link> Tag
π Connects external resources like CSS or preconnect links to the HTML document.
<link rel="stylesheet" href="style.css">
- π― Why use: To load external stylesheets, icons, or fonts.
- π SEO Benefit: Helps with structured layout and faster load times (preload/preconnect).
- π Other: Commonly used for favicons too.
π₯οΈ <body> Tag
π Contains all visible webpage content including text, images, and interactive elements.
<body> <h1>Hello World</h1> <p>This is my page</p> </body>
- π― Why use: Defines visible part of HTML.
- π SEO Benefit: Proper hierarchy helps crawlers understand content.
π’ <h1> Tag
π Defines the main heading of a page. Only one <h1>
should exist per page.
<h1>HTML Tags Guide</h1>
- π― Why use: Represents the main topic of the page.
- π SEO Benefit: Major ranking factor; search engines rely on it heavily.
π’ <h2> Tag
π Defines secondary headings, useful for structuring content under <h1>
.
<h2>SEO Benefits of HTML Tags</h2>
- π― Why use: To organize content sections clearly.
- π SEO Benefit: Helps crawlers understand content hierarchy.
π’ <h3> Tag
π Used for sub-subheadings beneath <h2>
.
<h3>Example Section</h3>
- π― Why use: Provides deeper structure.
- π SEO Benefit: Supports semantic structure and keyword placement.
π’ <h4> Tag
π Used for smaller headings within <h3>
sections.
<h4>Sub Topic</h4>
- π― Why use: To provide fine-grained structure.
- π SEO Benefit: Not as strong as
<h1>
, but aids readability & keyword distribution.
π’ <h5> Tag
π Subheading deeper than <h4>
.
<h5>Minor Sub Section</h5>
- π― Why use: For less critical headings.
- π SEO Benefit: Minor, but supports structure & accessibility.
π’ <h6> Tag
π The lowest level heading, often used for captions or small notes.
<h6>Footnote</h6>
- π― Why use: Marks very minor sections.
- π SEO Benefit: Minimal, but keeps hierarchy clean.
βοΈ <p> Tag
π Defines a paragraph of text.
<p>This is a paragraph.</p>
- π― Why use: For clear, readable text.
- π SEO Benefit: Proper paragraphs improve readability and ranking.
β©οΈ <br> Tag
π Inserts a single line break.
Hello<br>World
- π― Why use: To break text lines manually.
- π SEO Benefit: Minimal, but improves formatting for crawlers & users.
β <hr> Tag
π Represents a thematic break between content sections.
<hr>
- π― Why use: To separate content clearly.
- π SEO Benefit: Aids readability & improves UX, indirectly helping SEO.
π <a> Tag
π Defines hyperlinks to navigate between pages or sections.
<a href="https://codeformatting.com">Visit Example</a>
- π― Why use: Essential for navigation.
- π SEO Benefit: Anchor text helps search engines understand linked content.
πΌοΈ <img> Tag
π Displays images on a webpage.
<img src="image.jpg" alt="Description">
- π― Why use: For visuals, branding, and design.
- π SEO Benefit: Alt attributes improve accessibility and image SEO rankings.
πͺ <strong> Tag
π Emphasizes text with strong importance (usually bold).
<strong>Important</strong>
- π― Why use: To highlight critical words.
- π SEO Benefit: Search engines may treat emphasized words as more relevant.
β¨ <em> Tag
π Emphasizes text in an italic style.
<em>Highlighted</em>
- π― Why use: For words requiring subtle emphasis.
- π SEO Benefit: Adds semantic meaning, helping crawlers understand context.
π€ <b> Tag
π Makes text bold, without semantic importance.
<b>Bold Text</b>
- π― Why use: For styling emphasis.
- π SEO Benefit: Minimal compared to
<strong>
, but improves readability.
β <s> Tag
π The <s>
tag represents text that is no longer accurate or relevant β rendered with a strikethrough.
<p>Old price: <s>$49.99</s></p>
- π― Why use: To visually show removed or obsolete content without deleting it.
- π SEO Benefit: Keeps historical/contextual text accessible to crawlers β useful for content clarity; but don't mark up important keywords as removed.
- π Other: Use
<del>
when you want to indicate deletions with semantic meaning for edits.
β° <u> Tag
π The <u>
tag represents text with an unarticulated non-emphatic annotation β typically displayed underlined.
<p>This is an <u>underlined note</u> for emphasis.</p>
- π― Why use: For stylistic underlining when semantics are not the goal.
- π SEO Benefit: Minimal; avoid using
<u>
for links β use <a>
instead. - π Other: CSS is usually preferred for styling underlines to separate content from presentation.
π <small> Tag
π The <small>
tag renders side-comments and small print (like copyright or disclaimers).
<p>Terms apply. <small>See full T&C</small></p>
- π― Why use: To semantically mark boilerplate or legal notes.
- π SEO Benefit: Helps crawlers differentiate primary content from legal or auxiliary text.
- π Other: Keep critical keywords out of
<small>
since search engines weigh them less.
π¨ <mark> Tag
π The <mark>
tag highlights parts of text (yellow by default) β great for search-result highlighting.
<p>Search result: <mark>html tags</mark></p>
- π― Why use: To visually mark relevant text snippets.
- π SEO Benefit: Improves UX by showing users highlighted keyword matches β can increase CTR and time on page.
- π Other: Use sparingly β avoid over-highlighting which can dilute meaning.
βοΈ <del> Tag
π The <del>
tag semantically marks text that has been removed from the document (often combined with datetime
).
<p>Version 1: <del datetime="2025-01-01">Old text</del></p>
- π― Why use: To show historical edits with semantic meaning.
- π SEO Benefit: Maintains transparency for users and crawlers; useful in changelogs.
- π Other: Combine with
<ins>
for edit histories.
β <ins> Tag
π The <ins>
tag indicates inserted text, often used together with <del>
for revision tracking.
<p>Changes: <del>old</del> <ins>new</ins></p>
- π― Why use: To show additions clearly in docs or articles.
- π SEO Benefit: Helps crawlers understand content evolution; good for editorial transparency.
- π Other: Use
datetime
when timestamping edits.
β <sub> Tag
π The <sub>
tag displays text as subscript (e.g., chemical formulas or footnote markers).
H<sub>2</sub>O
- π― Why use: For scientific notation or chemical formulas.
- π SEO Benefit: Proper semantic marking helps accessibility and accurate content parsing.
- π Other: Avoid using CSS hacks; use the semantic tag for best accessibility.
βΏ <sup> Tag
π The <sup>
tag renders superscript text (e.g., exponents, footnote references).
x<sup>2</sup> = x * x
- π― Why use: For mathematical exponents or citation marks.
- π SEO Benefit: Keeps meaning explicit for screen readers and parsers.
- π Other: Combine with
aria-label
if the content needs verbose explanation for accessibility.
π» <code> Tag
π The <code>
tag indicates a fragment of computer code β inline or block-level when used with <pre>
.
<p>Use <code>git commit</code> to save changes.</p>
- π― Why use: To semantically mark code snippets for readers and tools.
- π SEO Benefit: Improves readability for technical content and helps search engines index code snippets accurately.
- π Other: For larger code blocks, wrap
<code>
inside <pre>
for preserved whitespace.
β¨οΈ <kbd> Tag
π The <kbd>
tag denotes user input from a keyboard or device (e.g., shortcut keys).
Press <kbd>Ctrl</kbd> + <kbd>S</kbd> to save.
- π― Why use: To visually and semantically indicate keyboard shortcuts.
- π SEO Benefit: Enhances the usability of documentation pages; minor indirect SEO benefits via better UX.
- π Other: Style with CSS to match your design system for clarity.
π£ <var> Tag
π The <var>
tag represents a variable or placeholder in code or math expressions.
<p>Let <var>x</var> be the number of items.</p>
- π― Why use: To semantically mark variables for readability and parsing.
- π SEO Benefit: Helps technical content be understood correctly by bots and assistive tech.
- π Other: Works well with
<code>
and <pre>
for documentation.
π¨οΈ <samp> Tag
π The <samp>
tag denotes sample output from a program or system.
<p>Output: <samp>File saved successfully</samp></p>
- π― Why use: To distinguish system output from code input or prose.
- π SEO Benefit: Improves clarity for technical articles and helps indexing of example outputs.
- π Other: Keep sample output concise and accurate for best educational value.
π§Ύ <pre> Tag
π The <pre>
tag preserves whitespace and line breaks β ideal for formatted code blocks or ASCII art.
<pre>
function sum(a, b) {
return a + b;
}
</pre>
- π― Why use: To show preformatted text exactly as written.
- π SEO Benefit: Makes code and formatted examples clear to both users and crawlers.
- π Other: Pair with syntax highlighting libraries for better UX.
π¬ <blockquote> Tag
π The <blockquote>
tag indicates a long quotation from another source β often displayed indented.
<blockquote>This is a quoted passage from a book.</blockquote>
- π― Why use: To give proper semantic markup to long quotes.
- π SEO Benefit: Quotes can enrich content and may be picked up as featured snippets when valuable.
- π Other: Include a
<cite>
or cite
attribute for attribution.
π <cite> Tag
π The <cite>
tag represents the title of a work (book, article, song) or the source of a quote.
<p>β <cite>Pride and Prejudice</cite></p>
- π― Why use: To semantically mark sources and titles.
- π SEO Benefit: Proper citation improves credibility and may help content authority signals.
- π Other: Not for citing peopleβs names β use within
<blockquote>
or nearby markup for clarity.
β β <q> Tag
π The <q>
tag is for short, inline quotations β browsers often render them with quotation marks.
<p>She said, <q>Hello there.</q></p>
- π― Why use: For short quotes inside paragraphs.
- π SEO Benefit: Proper semantic usage aids content parsing and readability.
- π Other: Use
<blockquote>
for longer excerpts.
π¬ <address> Tag
π The <address>
tag contains contact information for the nearest article or page author/owner.
<address> Acme Co. <br> 123 Main St. <br> support@example.com </address>
- π― Why use: To semantically mark contact details and organization info.
- π SEO Benefit: Helps local SEO and structured data signals; good for knowledge panel relevance.
- π Other: Avoid using for generic page footers unrelated to contact info.
β±οΈ <time> Tag
π The <time>
tag represents a specific date/time; supports a machine-readable datetime
attribute.
<time datetime="2025-09-12">September 12, 2025</time>
- π― Why use: To mark dates/times for events, posts, or schedules.
- π SEO Benefit: Improves indexing of event dates and can help rich results/time-sensitive content.
- π Other: Always use the ISO 8601 format in the
datetime
attribute for machine readability.
π <meter> Tag
π The <meter>
tag represents a scalar measurement within a known range (e.g., disk usage, battery level).
<meter min="0" max="100" value="70">70%</meter>
- π― Why use: To display quantitative gauges with semantic meaning.
- π SEO Benefit: Improves UX and accessibility; some crawlers can extract structured UI info.
- π Other: Use ARIA attributes if needed for better screen-reader announcements.
β³ <progress> Tag
π The <progress>
tag displays progress of a task (e.g., file upload) β shows completion percentage.
<progress value="40" max="100">40%</progress>
- π― Why use: To provide visual feedback on ongoing tasks.
- π SEO Benefit: Improves user engagement and perceived performance β indirect SEO gain.
- π Other: Complement with text labels for accessibility.
π¨ <canvas> Tag
π Used to draw graphics, charts, and animations via JavaScript.
<canvas id="myCanvas"></canvas>
- π― Why use: For dynamic, interactive visuals like games or charts.
- π SEO Benefit: No direct benefit, but enhances user engagement.
π <caption> Tag
π Provides a title or explanation for a <table> element.
<table> <caption>Monthly Sales Data</caption> <tr><th>Month</th><th>Sales</th></tr> </table>
- π― Why use: Improves accessibility and context for tables.
- π SEO Benefit: Adds semantic meaning, helping search engines understand data context.
π <col> Tag
π Defines attributes for columns in a table.
<table> <colgroup> <col style="background:lightgray"> <col style="background:white"> </colgroup> </table>
- π― Why use: Apply styles or attributes to entire columns.
- π SEO Benefit: No direct effect, but enhances data presentation.
π <colgroup> Tag
π Groups one or more <col> elements in a table for styling.
<colgroup> <col span="2" style="background-color:yellow"> </colgroup>
- π― Why use: Organizes table columns logically.
- π SEO Benefit: Improves table readability for users, indirectly helping SEO.
π <data> Tag
π Links content with machine-readable data values.
<data value="101">Product A</data>
- π― Why use: Bridges human-readable text with machine-readable data.
- π SEO Benefit: Helps search engines better understand structured data.
π <datalist> Tag
π Provides autocomplete suggestions for <input> fields.
<input list="browsers"> <datalist id="browsers"> <option value="Chrome"> <option value="Firefox"> </datalist>
- π― Why use: Enhances user input experience.
- π SEO Benefit: Improves form usability, indirectly boosting engagement.
π <details> Tag
π Creates a collapsible disclosure widget.
<details> <summary>More Info</summary> <p>Hidden content goes here.</p> </details>
- π― Why use: Show/hide optional content.
- π SEO Benefit: Search engines index hidden content inside, helping keyword coverage.
π <dfn> Tag
π Represents the defining instance of a term.
<p><dfn>SEO</dfn> stands for Search Engine Optimization.</p>
- π― Why use: Highlights first-time term definitions.
- π SEO Benefit: Helps with glossary and knowledge graph recognition.
π¬ <dialog> Tag
π Defines a modal or popup dialog box.
<dialog open>Hello World</dialog>
- π― Why use: For pop-ups, modals, or confirmation boxes.
- π SEO Benefit: No direct effect, but improves user interaction.
π¦ <div> Tag
π Defines a generic container for grouping content.
<div className="container">Content here</div>
- π― Why use: Flexible layout container.
- π SEO Benefit: Neutral tag, but useful when combined with semantic tags.
π <dl> Tag
π Represents a description list (terms and definitions).
<dl> <dt>HTML</dt> <dd>HyperText Markup Language</dd> </dl>
- π― Why use: For glossaries or Q&A formats.
- π SEO Benefit: Helps structured content appear in rich snippets.
π <dt> Tag
π Defines a term inside a <dl> list.
<dt>CSS</dt>
- π― Why use: Mark important glossary terms.
- π SEO Benefit: Enhances structured glossary or FAQ SEO.
βΉοΈ <dd> Tag
π Defines a description or value in a <dl> list.
<dd>Cascading Style Sheets</dd>
- π― Why use: Provides explanation for a glossary term.
- π SEO Benefit: Supports structured definition SEO.
π₯ <embed> Tag
π Embeds external content (e.g., video, audio, plugins).
<embed src="video.mp4" type="video/mp4">
- π― Why use: To include external multimedia content.
- π SEO Benefit: Increases engagement with multimedia.
ποΈ <fieldset> Tag
π Groups form fields together under one section.
<fieldset> <legend>User Info</legend> <input type="text"> </fieldset>
- π― Why use: Improves form accessibility and structure.
- π SEO Benefit: Better user experience leads to lower bounce rates.
πΌοΈ <figcaption> Tag
π Provides a caption for an image or media inside <figure>.
<figure> <img src="image.jpg" alt="Nature"> <figcaption>A beautiful landscape</figcaption> </figure>
- π― Why use: Adds descriptions to visuals.
- π SEO Benefit: Helps with image SEO and accessibility.
πΌοΈ <figure> Tag
π Used to group self-contained content like images, diagrams, or code snippets with captions.
<figure> <img src="sunset.jpg" alt="Sunset"> <figcaption>A calm evening view</figcaption> </figure>
- π― Why use: Semantic grouping of media content.
- π SEO Benefit: Helps Google associate captions with media.
π» <footer> Tag
π Defines the footer section of a webpage or section.
<footer> <p>Β© 2025 My Website</p> </footer>
- π― Why use: Store credits, copyright, or navigation links.
- π SEO Benefit: Adds structured page layout, helpful for crawlers.
π <form> Tag
π Defines an input form for user data submission.
<form action="/submit" method="post"> <input type="text" name="username"> <button>Submit</button> </form>
- π― Why use: Collect user input.
- π SEO Benefit: Improves interactivity, boosting engagement signals.
π <header> Tag
π Represents the top section of a page or section, usually with navigation.
<header> <h1>My Website</h1> <nav>...</nav> </header>
- π― Why use: Provides branding and navigation at the top.
- π SEO Benefit: Structured page design helps crawlers.
βΉοΈ <i> Tag
π Displays text in italic without semantic emphasis.
<i>Italic Text</i>
- π― Why use: Style for alternate voice or labels.
- π SEO Benefit: Minimal, better to use <em> for SEO meaning.
πΌοΈ <iframe> Tag
π Embeds another HTML page inside a current page.
<iframe src="https://example.com"></iframe>
- π― Why use: Embed videos, maps, or external content.
- π SEO Benefit: Indirect; must optimize embedded content separately.
πΌοΈ <img> Tag
π Embeds an image into a page.
<img src="cat.jpg" alt="Cute Cat">
- π― Why use: Display visual content.
- π SEO Benefit: Alt text critical for image SEO and accessibility.
β¨οΈ <input> Tag
π Collects user input in forms.
<input type="email" placeholder="Enter email">
- π― Why use: For interactive user data.
- π SEO Benefit: Improves form usability and conversions.
π·οΈ <label> Tag
π Defines labels for form inputs.
<label for="name">Name:</label> <input id="name" type="text">
- π― Why use: Improves form accessibility.
- π SEO Benefit: Better form usability, indirectly supporting rankings.