HTML Cheat Sheet & Reference

Basic Tags

Structure

  • <!DOCTYPE> — Defines the document type
  • <html> — Root element of the page
  • <head> — Metadata container
  • <body> — Visible content container
  • <title> — Page title

Text & Headings

  • <h1>–<h6> — Headings
  • <p> — Paragraph
  • <br /> — Line break
  • <hr /> — Horizontal rule

Links & Images

  • <a> — Anchor / hyperlink
  • <img /> — Image
  • <map> / <area /> — Image maps

Formatting

Text Formatting

  • <b> — Bold
  • <i> — Italic
  • <u> — Underline (deprecated)
  • <strong> — Strong emphasis
  • <em> — Emphasized text
  • <mark> — Highlighted text

Quotations & Code

  • <blockquote> — Long quotation
  • <q> — Short inline quote
  • <code> — Code snippet
  • <pre> — Preformatted text
  • <kbd> — Keyboard input
  • <samp> — Program output

Forms & Tables

Forms

  • <form> — Form container
  • <input /> — Input field
  • <textarea> — Multiline text
  • <button> — Button
  • <select> / <option> — Dropdown
  • <label> — Label for input

Tables

  • <table> — Table container
  • <tr> — Table row
  • <th> — Header cell
  • <td> — Data cell
  • <thead> / <tbody> / <tfoot>

Attributes

Core Attributes

  • class — CSS class name
  • id — Unique identifier
  • style — Inline CSS
  • title — Tooltip text

Language & Direction

  • lang — Language of content
  • dir — Text direction (ltr/rtl)
  • xml:lang — XML language

HTML Events

Mouse Events

  • onclick
  • ondblclick
  • onmousedown
  • onmousemove
  • onmouseout
  • onmouseover
  • onmouseup

Form Events

  • onfocus
  • onblur
  • onchange
  • oninput
  • onsubmit
  • onreset

Entities

Common Entities

  • &amp; → &
  • &lt; → <
  • &gt; → >
  • &nbsp; → non-breaking space
  • &copy; → ©
  • &reg; → ®
  • &trade; → ™
  • &euro; → €

HTTP Status Codes

1XX Informational

  • 100 Continue
  • 101 Switching Protocols

2XX Success

  • 200 OK
  • 201 Created
  • 204 No Content

4XX Client Error

  • 400 Bad Request
  • 401 Unauthorized
  • 404 Not Found

5XX Server Error

  • 500 Internal Server Error
  • 503 Service Unavailable
  • 504 Gateway Timeout