dev.rean.me
html

Complete HTML Reference — Tags, Attributes, Events & Best Practices

Complete HTML reference guide covering all HTML5 tags, attributes, global attributes, event handlers, character entities, meta tags, input types, and best practices for web developers.

2026-09-19 · 21 min read

Share:
🎓 COMPLETE COURSE DIRECTORY

HTML & Web Development Complete Tutorial Series & Course List

Master HTML5 tags, forms, tables, dropdowns, lists, Google Fonts, VS Code tools, and web development fundamentals step-by-step with 11 complete tutorials.

Hello my friend! Welcome to the Complete HTML Reference on dev.rean.me! This page is your one-stop reference for every important HTML5 tag, attribute, event, input type, meta tag, and character entity — organized by category so you can find what you need instantly!

Bookmark this page and use it every time you write HTML! Let's go!


1. 📄 Document Structure Tags

Every HTML document starts with these foundational structural tags.

TagDescription
<!DOCTYPE html>Declares the document as HTML5 — must be the very first line
<html>Root element of the HTML page. Add lang="en" for accessibility
<head>Container for meta information (not visible on the page)
<title>Sets the browser tab title and SEO title
<body>Contains all visible page content
<meta>Defines page metadata (charset, viewport, description, OG tags)
<link>Links external resources like CSS stylesheets and favicons
<style>Embeds internal CSS styles directly in the page
<script>Embeds or links external JavaScript
<base>Sets a base URL for all relative links on the page
<noscript>Fallback content shown when JavaScript is disabled

💡 Tip: Always add <meta charset="UTF-8"> and <meta name="viewport" content="width=device-width, initial-scale=1.0"> inside every <head> — these two lines make your page Unicode-safe and mobile responsive!

📖 Related: HTML Cheat Sheet with Examples & Best Practices


2. 🗂️ Semantic Layout / Section Tags

Semantic tags give meaning to page structure for both browsers and search engines.

TagDescription
<header>Top section of a page or section — logo, site title, nav
<nav>Navigation menu — a group of navigation links
<main>The primary/unique content of the page (only one per page)
<article>Self-contained content — blog post, news article, card
<section>Thematic grouping of content with a heading
<aside>Side content — sidebar, related articles, ads
<footer>Bottom section — copyright, contact links, legal
<address>Contact information for the nearest <article> or <body>
<details>Native collapsible disclosure widget (accordion)
<summary>Visible heading/label for a <details> element
<dialog>Native modal dialog popup window

💡 Tip: Avoid Div Soup! Use <header>, <nav>, <main>, <article>, <section>, <aside>, and <footer> instead of generic <div> everywhere. This helps Google understand your page and improves accessibility!

📖 Related: HTML Tips and Tricks with Examples


3. 📝 Text Content Tags

Tags for headings, paragraphs, quotes, code, and inline text formatting.

TagDescription
<h1> to <h6>Headings — <h1> is the most important (only one per page!)
<p>Paragraph of text
<br>Line break (self-closing)
<hr>Horizontal divider line
<pre>Preformatted text that preserves spaces and line breaks
<blockquote>Long quotation block — use cite attribute for source URL
<q>Inline quotation — browser adds quotation marks automatically
<cite>Title of a creative work (book, film, article)
<abbr>Abbreviation or acronym — use title attribute for full text
<address>Physical or digital contact information
<time>Machine-readable date/time — use datetime attribute
<code>Inline code snippet
<pre><code>Multi-line code block
<kbd>Keyboard input — displays like a keyboard key
<samp>Sample output from a program or script
<var>Variable in math or programming context
<mark>Highlighted/marked text (yellow background by default)
<del>Deleted (strikethrough) text
<ins>Inserted (underlined) text
<sub>Subscript text — H₂O
<sup>Superscript text — E=mc²
<small>Fine print, copyright, legal text
<strong>Important text — renders bold, carries semantic meaning
<b>Bold text — visual only, no semantic meaning
<em>Emphasized text — renders italic, carries semantic stress
<i>Italic text — visual only, also used for icons
<u>Underlined text
<s>Strikethrough text — no longer accurate
<wbr>Word break opportunity — hint where a long word can break
<bdo>Bi-directional text override — change text direction
<ruby>Ruby annotation for East Asian typography

💡 Tip: Use <strong> for important text (screen readers emphasize it) and <em> for stressed text — do not use <b> and <i> for semantic meaning!

📖 Related: Complete List of HTML Elements & Tags with Clickable Tag Links


Tag / AttributeDescription
<a href="...">Hyperlink to another page, section, email, or phone
target="_blank"Opens link in a new browser tab
target="_self"Opens link in the same tab (default)
rel="noopener noreferrer"Security attribute — always use with target="_blank"
href="#id"Anchor link — jumps to an element with that id
href="mailto:..."Opens the default email client
href="tel:..."Initiates a phone call on mobile devices
download="filename"Forces the browser to download the linked file
<nav>Semantic wrapper for navigation link groups

💡 Tip: Whenever you use target="_blank", always add rel="noopener noreferrer" to prevent tab-nabbing — a security vulnerability where the opened page can control the opener window!

📖 Related: HTML Tips and Tricks with Examples


5. 🖼️ Image & Media Tags

TagDescription
<img>Embeds an image — always add alt, width, and height
<picture>Responsive image container for art-directed images
<source>Alternative image/media source inside <picture>, <video>, <audio>
<figure>Self-contained media content with optional caption
<figcaption>Caption for a <figure> element
<video>Embeds a video player
<audio>Embeds an audio player
<track>Text track for subtitles, captions inside <video>
<embed>Embeds external plugin content
<object>Embeds external resources (PDF, Flash, etc.)
<canvas>2D/3D drawing surface controlled by JavaScript
<svg>Scalable Vector Graphics — inline XML-based vector image
<iframe>Embeds another HTML page (YouTube, Google Maps, etc.)
<map>Image map container with clickable hotspot areas
<area>Defines clickable area inside an image map

Important <img> Attributes:

AttributeDescription
srcPath or URL of the image file
altAlternative text for accessibility and SEO
width / heightReserve layout space to prevent Cumulative Layout Shift
loading="lazy"Defer loading until image is near the viewport
loading="eager"Load image immediately (use for above-the-fold images)
decoding="async"Decode image off the main thread for better performance
fetchpriority="high"Mark LCP (hero) image as high priority
srcsetProvide multiple image sources for different screen densities
sizesTell browser which image size to use at different viewports

💡 Tip: Always specify width and height on <img> tags! Without them, the browser does not know the image size before it loads, causing content to jump around — hurting your Core Web Vitals (CLS) score!

📖 Related: How to Add Multiple Google Fonts in HTML & CSS


6. 📋 List Tags

TagDescription
<ul>Unordered (bullet) list
<ol>Ordered (numbered) list
<li>List item — child of <ul> or <ol>
<dl>Description / definition list
<dt>Term or name in a <dl> list
<dd>Description or definition of the <dt> term

<ol> Attributes:

AttributeDescription
type="1"Numbers (default)
type="A"Uppercase letters
type="a"Lowercase letters
type="I"Uppercase Roman numerals
type="i"Lowercase Roman numerals
start="5"Start numbering from a custom number
reversedCounts down instead of up

📖 Related: Different Lists in HTML (UL vs OL vs DL) with Video Examples


7. 📊 Table Tags

TagDescription
<table>Container for the entire table
<caption>Visible title above the table (good for accessibility)
<thead>Groups header rows — semantic section
<tbody>Groups body data rows — semantic section
<tfoot>Groups footer rows — semantic section
<tr>Table row
<th>Table header cell — bold and centered by default
<td>Table data cell
<colgroup>Groups columns for shared styling
<col>Defines properties for one or more columns

Table Cell Attributes:

AttributeDescription
colspan="2"Span across 2 columns
rowspan="3"Span down across 3 rows
scope="col"Indicates a <th> is a column header (accessibility)
scope="row"Indicates a <th> is a row header (accessibility)

📖 Related: How to Use HTML Table Tag


8. 📝 Form Tags & Attributes

TagDescription
<form>Container for all form controls
<label>Accessible label for form controls — always use with for
<input>Interactive form control — many types available (see below)
<textarea>Multi-line text input area
<select>Dropdown selection list
<option>Individual item inside <select> or <datalist>
<optgroup>Groups related <option> items with a label
<datalist>Auto-complete suggestion list linked to an <input>
<button>Clickable button — always specify type
<fieldset>Groups related form fields with a visual border
<legend>Title/caption for a <fieldset> group
<output>Displays result of a calculation or script
<progress>Progress bar showing task completion
<meter>Scalar gauge — disk usage, score, temperature

<form> Attributes:

AttributeDescription
action="/url"URL where form data is submitted
method="GET"Appends data to URL query string
method="POST"Sends data in the request body (more secure)
enctype="multipart/form-data"Required for file upload forms
novalidateDisables browser built-in validation
autocomplete="off"Turns off browser autofill for the whole form

<button> Types:

TypeDescription
type="submit"Submits the form (default inside a <form>)
type="reset"Resets all form fields to initial values
type="button"No default behavior — triggers JavaScript

💡 Tip: Always pair <label for="input-id"> with <input id="input-id">. When a user clicks the label text, the input gets focus automatically — this is especially important for checkboxes and radio buttons on mobile!

📖 Related: How to Use Fieldsets with Radios and Checkbox in HTML


9. ✏️ Input Types Reference

The <input> tag supports over 20 different type values!

TypeDescription
textSingle-line text input (default)
passwordMasked password input
emailEmail address — validates @ format
numberNumeric input with min/max/step
telTelephone number input
urlURL input — validates http/https format
searchSearch field — sometimes shows clear button
dateDate picker — YYYY-MM-DD format
timeTime picker — HH:MM format
datetime-localDate and time picker (no timezone)
monthMonth and year picker
weekWeek number picker
colorNative color picker
rangeSlider control for numeric range
fileFile upload picker — use with enctype="multipart/form-data"
checkboxBoolean checkbox — checked state
radioRadio button — single choice from a group
submitSubmit button
resetReset button
buttonGeneric button with no default behavior
imageImage as a submit button
hiddenHidden field not shown to user

Common <input> Attributes:

AttributeDescription
idUnique ID — connect to <label for="...">
nameKey name sent with form data
valueDefault or preset value
placeholderHint text shown when field is empty
requiredMakes field mandatory before submitting
disabledDisables the field completely
readonlyField is visible but not editable
autofocusFocus this field when page loads
autocompleteControl browser autofill behavior
min / maxMinimum and maximum values (number, date, range)
stepIncrement step for number and range
minlength / maxlengthMin/Max character length for text
patternRegex validation pattern
multipleAllow selecting multiple files or email addresses
acceptRestrict accepted file types (file input)
checkedPre-check a checkbox or radio button
sizeVisible width in characters

📖 Related: Everything About Dropdown List in HTML (select, option, optgroup) · Dropdown with Auto-Complete using datalist


10. 🌐 Global Attributes

These attributes can be applied to any HTML element.

AttributeDescription
idUnique identifier — must be unique on the page
classCSS class name(s) for styling
styleInline CSS styles
titleTooltip text shown on hover
langLanguage of the element's content
dirText direction: ltr (left-to-right) or rtl
tabindexControls keyboard focus order (0 = focusable, -1 = no tab)
hiddenHides element from display and screen readers
data-*Custom data attribute — accessible via JavaScript
draggableMakes an element draggable — true or false
contenteditableMakes an element's content directly editable
spellcheckEnables/disables spell checking
translateWhether content should be translated — yes or no
accesskeyKeyboard shortcut key to focus the element

11. ♿ ARIA Accessibility Attributes

ARIA (Accessible Rich Internet Applications) attributes make web content accessible to screen readers.

AttributeDescription
aria-labelProvides an accessible name not visible on screen
aria-labelledbyPoints to an element whose text is the accessible name
aria-describedbyPoints to an element that describes this element
aria-hidden="true"Hides the element from screen readers (icon decoration)
aria-liveAnnounces dynamic content changes (polite, assertive)
aria-expandedIndicates if a collapsible element is open or closed
aria-selectedIndicates selected state in a list or tab
aria-checkedState of a custom checkbox or radio
aria-disabledMarks element as disabled for screen readers
aria-requiredMarks form field as required for screen readers
aria-invalidMarks field as having an invalid value
aria-currentMarks the current item — page, step, location
aria-roleDefines the ARIA role of an element
role="button"Non-button elements acting as buttons
role="alert"Announces important status messages
role="navigation"Marks navigation landmark
role="main"Marks the main content landmark
role="dialog"Marks a modal dialog

12. ⚡ HTML Events Reference

Attach JavaScript behavior directly to HTML elements using event attributes.

🖱️ Mouse Events

EventTriggers When...
onclickUser clicks the element
ondblclickUser double-clicks the element
onmouseenterMouse pointer enters the element area
onmouseleaveMouse pointer leaves the element area
onmousemoveMouse pointer moves over the element
onmousedownMouse button is pressed
onmouseupMouse button is released
oncontextmenuRight-click context menu is triggered
onwheelMouse wheel is scrolled

⌨️ Keyboard Events

EventTriggers When...
onkeydownA key is pressed down
onkeyupA key is released
onkeypressA key is pressed and held (deprecated — use onkeydown)

📝 Form Events

EventTriggers When...
onchangeInput value changes and loses focus
oninputInput value changes in real time
onfocusElement receives keyboard/mouse focus
onblurElement loses focus
onsubmitForm is submitted
onresetForm is reset
onselectText inside an input is selected
oninvalidInput fails built-in validation

📄 Window & Document Events

EventTriggers When...
onloadPage (or element) has fully loaded
onunloadPage is being closed or navigated away
onresizeBrowser window is resized
onscrollPage or element is scrolled
onhashchangeURL hash (#) changes

📱 Touch Events

EventTriggers When...
ontouchstartTouch begins on the element
ontouchendTouch ends on the element
ontouchmoveFinger moves while touching
ontouchcancelTouch is interrupted

🎬 Media Events

EventTriggers When...
onplayMedia starts playing
onpauseMedia is paused
onendedMedia playback reaches the end
onvolumechangeVolume is changed
ontimeupdatePlayback position updates
oncanplayBrowser can start playing media

📖 Related: How to Create Simple Calculator in HTML (uses oninput event)


13. 🔖 Meta Tags Reference

Meta tags go inside <head> and control SEO, social sharing, and browser behavior.

SEO & Page Info

<!-- Character encoding — always first! -->
<meta charset="UTF-8" />

<!-- Mobile responsive viewport -->
<meta name="viewport" content="width=device-width, initial-scale=1.0" />

<!-- Page description for search engines (keep under 160 chars) -->
<meta name="description" content="Your page description here." />

<!-- Page keywords (less important now but still used) -->
<meta name="keywords" content="html, css, javascript" />

<!-- Author name -->
<meta name="author" content="Your Name" />

<!-- Prevent search engine indexing -->
<meta name="robots" content="noindex, nofollow" />

<!-- Auto refresh page every 30 seconds -->
<meta http-equiv="refresh" content="30" />

Open Graph (Social Sharing)

<!-- Facebook / LinkedIn / WhatsApp preview -->
<meta property="og:title" content="Your Page Title" />
<meta property="og:description" content="Your page description." />
<meta property="og:image" content="https://example.com/og-image.jpg" />
<meta property="og:url" content="https://example.com/page" />
<meta property="og:type" content="website" />
<meta property="og:site_name" content="Your Site Name" />

Twitter Card

<!-- Twitter preview card -->
<meta name="twitter:card" content="summary_large_image" />
<meta name="twitter:title" content="Your Page Title" />
<meta name="twitter:description" content="Your page description." />
<meta name="twitter:image" content="https://example.com/twitter-image.jpg" />
<meta name="twitter:site" content="@yourhandle" />

14. 🔣 HTML Character Entities

Use character entities to display special characters that might conflict with HTML code.

EntityCharacterDescription
&amp;&Ampersand
&lt;<Less than
&gt;>Greater than
&quot;"Double quote
&apos;'Single quote / apostrophe
&nbsp;(space)Non-breaking space
&copy;©Copyright
&reg;®Registered trademark
&trade;™Trademark
&euro;€Euro currency
&pound;£British pound
&yen;¥Japanese yen
&cent;¢Cent
&deg;°Degree symbol
&plusmn;±Plus or minus
&times;×Multiplication
&divide;÷Division
&frac12;½One half
&frac14;¼One quarter
&mdash;—Em dash
&ndash;–En dash
&laquo;«Left angle quote
&raquo;»Right angle quote
&hellip;…Ellipsis
&hearts;♥Heart
&spades;♠Spade
&clubs;♣Club
&diams;♦Diamond
&#9733;★Solid star
&#9734;☆Outline star

15. ✅ HTML5 Best Practices Checklist

Here is a quick checklist every HTML developer should follow:

  • ✅ Start every file with <!DOCTYPE html> declaration
  • ✅ Set <html lang="en"> and <meta charset="UTF-8">
  • ✅ Add responsive viewport meta tag inside every <head>
  • ✅ Use only one <h1> per page for the main page title
  • ✅ Use semantic tags (<header>, <nav>, <main>, <article>, <section>, <footer>)
  • ✅ Link every <input> with <label for="id"> for accessibility
  • ✅ Always add descriptive alt text to every <img> tag
  • ✅ Specify width and height on images to prevent layout shift
  • ✅ Add loading="lazy" on below-the-fold images for performance
  • ✅ Add rel="noopener noreferrer" to all target="_blank" links
  • ✅ Use aria-label on icon-only buttons for screen reader support
  • ✅ Add <meta name="description"> for SEO on every page
  • ✅ Add Open Graph meta tags for social sharing previews
  • ✅ Validate your HTML at validator.w3.org

📖 Related: HTML Tips and Tricks with Examples



Hope this HTML reference guide helps you write better, cleaner, and more accessible HTML every day! Bookmark this page and share it with your developer friends! 🌐✨

🎓 COMPLETE COURSE DIRECTORY

HTML & Web Development Complete Tutorial Series & Course List

Master HTML5 tags, forms, tables, dropdowns, lists, Google Fonts, VS Code tools, and web development fundamentals step-by-step with 11 complete tutorials.

← Back to html
Share: