Document Structure WHATWG HTML
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Page Title</title>
</head>
<body>
...
</body>
</html> Element Anatomy tags + content
<a href="/page">Click here</a>
Void Elements no closing tag
| Element | Purpose | Common Attributes |
<br> | Line break | none |
<hr> | Thematic break | none |
<img> | Image | src, alt |
<input> | Form input | type, name |
<meta> | Metadata | charset, name |
<link> | External resource | rel, href |
<area> | Image map area | shape, coords |
<base> | Base URL | href |
<col> | Table column | span |
<embed> | Embedded content | src, type |
<source> | Media source | src, type |
<track> | Text track | src, kind |
<wbr> | Word break opportunity | none |
Character Entities named + numeric
| Entity | Numeric | Character | When Required |
& | & | & | Always in content |
< | < | < | Always in content |
> | > | > | After ]] in content |
" | " | " | In quoted attributes |
' | ' | ' | In single-quoted attributes |
|   | (space) | Non-breaking space |
DOCTYPE rendering mode
| Mode | Triggered By | Behavior |
| Standards | <!DOCTYPE html> | CSS box model, strict parsing |
| Almost Standards | Older DOCTYPEs with URL | Standards except table cell sizing |
| Quirks | Missing or malformed DOCTYPE | Legacy IE5 box model, loose parsing |
Meta Charset encoding declaration
| Scenario | Encoding Used |
| HTTP Content-Type header specifies charset | Header value takes precedence |
| BOM (Byte Order Mark) present | UTF-8 or UTF-16 per BOM |
<meta charset="..."> present | Specified encoding |
<meta http-equiv="Content-Type"> | Charset from content attribute |
| No declaration | windows-1252 (legacy default) |
<!-- Recommended: first element in <head> -->
<head>
<meta charset="UTF-8">
<title>...</title>
</head>
Default Attributes implicit values
| Element | Attribute | Default Value |
<input> | type | "text" |
<button> | type | "submit" |
<script> | type | "text/javascript" |
<style> | type | "text/css" |
<a> | target | "_self" |
<form> | method | "get" |
<form> | enctype | "application/x-www-form-urlencoded" |
<textarea> | wrap | "soft" |
<th> | scope | "auto" |
<link rel="stylesheet"> | type | "text/css" |
<ol> | type | "1" |
<ol> | start | 1 |
<img> | decoding | "auto" |
<video>, <audio> | preload | "auto" (browser-dependent) |