Article Title
This is the article paragraph.
<! DOCTYPE html >
< html >
< head >
<!-- Here are the metadata -->
</ head >
< body >
<!-- Here are the visual elements -->
</ body >
</ html >
<!-- Define the name of webpage -->
< title > Webpage name </ title >
<!-- Define metadata of webpage -->
< meta charset ="UTF-8" >
< meta name ="author" content ="David" >
<!-- Specify the base URL for resource files -->
< base href ="https://www.cheatsheet.com/" target ="_blank" >
<!-- Link external file to webpage -->
< link rel ="icon" href ="favicon.ico" >
<!-- Intro content -->
< header > </ header >
<!-- Navigation Bar -->
< nav > </ nav >
<!-- Main Body -->
< main > </ main >
<!-- Section inside main body -->
< section > </ section >
<!-- Left/Right side content -->
< aside > </ aside >
<!-- End of page -->
< footer > </ footer >
< br > <!-- Empty line -->
< hr > <!-- Horizonal line -->
< div >
< span > </ span >
< span > </ span >
</ div >
< h1 > Header 1 </ h1 >
< h2 > Header 2 </ h2 >
< h3 > Header 3 </ h3 >
< h4 > Header 4 </ h4 >
< h5 > Header 5 </ h5 >
< h6 > Header 6 </ h6 >
< p > Paragraph </ p >
< pre >
Pre-formatted text
Pre-formatted text
</ pre >
Paragraph
Pre-formatted text Pre-formatted text
< b > Bold </ b >
< i > Italic </ i >
< u > Underscore </ u >
< s > Strike </ s >
< small > Small </ small >
< sup > Superscript </ sup >
< sub > Subscript </ sub >
< mark > Mark </ mark >
< ruby > 寿司 < rt > すし</ rt > </ ruby >
< em > emphasized text </ em >
< ins > inserted text </ ins >
< del > deleted text </ del >
< strong > Important message!!! </ strong >
< address > 11 Wall St, New York </ address >
< time > 16:18:19 </ time >
< var > variable </ var >
< code > printf("Hello World"); </ code >
< abbr > HTML </ abbr >
< data value ="#FF0000" > Red </ data >
< samp > C:\user> Hello World </ samp >
< def > Term to be defined </ def >
< kbd > Ctrl + C </ kbd >
printf("Hello World");
HTML<!-- Bi-direction overwrite -->
< bdo dir ="rtl" > This text start from right to left </ bdo >
<!-- Bi-direction isolation -->
< p > Isolate the arabic(R->L) < bdi > العربية</ bdi > from English(L->R) text. </ p >
Isolate the arabic(R->L) العربية from English(L->R) text.
<!-- Word break -->
< p > LineBreakOccurAtWBR_Tag< wbr > IfLongWordIsOverflowed </ p >
LineBreakOccurAtWBR_Tag
< cite > Da Vinci, Leonardo. Mona Lisa. 1503 </ cite >
< blockquote cite ="example.com" > this is content from other website</ blockquote >
this is content from other website
< q > I have not failed, I've just found 10000 ways that don't work.</ q >
I have not failed, I've just found 10000 ways that don't work.
< hgroup >
< h1 > HTML </ h1 >
< p > A markup language for webpage </ p >
</ hgroup >
A markup language for webpage
< article >
< h1 > Article Title </ h1 >
< p > This is the article paragraph. </ p >
</ article >
This is the article paragraph.
<!-- Ordered List -->
< ol >
< li > Ordered Item 1 </ li >
< li > Ordered Item 2 </ li >
< li > Ordered Item 3 </ li >
</ ol >
<!-- Un-ordered List -->
< ul >
< li > Item X </ li >
< li > Item Y </ li >
< li > Item Z </ li >
</ ul >
<!-- Description List -->
< dl >
< dt > Espresso </ dt >
< dd > a concentrated pure coffee drink </ dd >
< dt > Latte </ dt >
< dd > mixing espresso with milk </ dd >
</ dl >
< table >
< caption > Fruit Market </ caption >
<!-- For Styling Columns -->
< calgroup >
< col style ="background-color:Sienna" >
< col style ="background-color:SteelBlue" >
< col style ="background-color:SteelBlue" >
</ calgroup >
<!-- Visible Table -->
< thead >
< tr >
< th > </ th > < th > Price</ th > < th > Quantity</ th >
</ tr >
</ thead >
< tbody >
< tr >
< td > apple</ td > < td > $1.6</ td > < td > 15</ td >
</ tr >
< tr >
< td > orange</ td > < td > $0.9</ td > < td > 8</ td >
</ tr >
</ tbody >
< tfoot >
< tr >
< td > Total:</ td > < td > $2.5</ td > < td > 23</ td >
</ tr >
</ tfoot >
</ table >
Price | Quantity | |
---|---|---|
apple | $1.6 | 15 |
orange | $0.9 | 8 |
Total: | $2.5 | 23 |
< input type ="text" >
< input type ="email" >
< input type ="number" >
< input type ="password" >
< input type ="search" >
< input type ="tel" >
< input type ="url" >
< textarea >
Here is text area
</ textarea >
< input list ="mylist" >
< datalist id ="mylist" >
< option > Hawaii </ option >
< option > Margherita </ option >
</ datalist >
< button > Button </ button >
< input type ="button" >
< input type ="image" src ="snow.svg" >
< input type ="reset" >
< input type ="submit" >
< input type ="date" >
< input type ="week" >
< input type ="month" >
< input type ="time" >
< input type ="datetime-local" >
< select >
< option > option 1</ option >
< option > option 2</ option >
< optgroup label ="Option Group" >
< option > option 3</ option >
< option > option 4</ option >
</ optgroup >
</ select >
< input type ="checkbox" >
< input type ="color" >
< input type ="radio" >
< input type ="range" >
< input type ="file" >
< form oninput ="out.value=parseInt(i.value);
meter.value=parseInt(i.value)/100;
prog.value=parseInt(i.value)/100"; >
<!-- Input: -->
< input type ="number" id ="i" >
<!-- Output: -->
< output name ="out" > 0</ output >
< meter id ="meter" > </ meter >
< progress id ="prog" > </ progress >
</ form >
< form >
< fieldset >
< legend > Group A</ legend >
< label > First Name:</ label > < input type ="text" > < br >
< label > Last Name:</ label > < input type ="text" >
</ fieldset >
< fieldset >
< legend > Group B</ legend >
< label for ="ra" > Male:</ label >
< input id ="ra" name ="form" type ="radio" >
< label for ="rb" > Female:</ label >
< input id ="rb" type ="radio" name ="form" >
</ fieldset >
</ form >
<!-- Alternate image base on screen size -->
< picture >
< source media ="(max-width:700px)" srcset ="img_s.jpg" >
< source media ="(max-width:1000px)" srcset ="img_m.jpg" >
<!-- Image (can be used alone) -->
< img src ="img.jpg" >
</ picture >
<!-- Browser pick the first supported format -->
< video controls >
< source src ="meme.mp4" type ="video/mp4" >
< source src ="meme.webm" type ="video/webm" >
<!-- Subtitles -->
< track src ="subtitle.vtt" kind ="subtitles" >
</ video >
<!-- Browser pick the first supported format -->
< audio controls >
< source src ="audio.mp3" type ="audio/mp3" >
< source src ="audio.wav" type ="audio/wav" >
</ audio >
< iframe src ="https://www.youtube.com/embed/3KtWfp0UopM?si=H-gkLOLB_rtG5DdE" > </ iframe >
< canvas width ="200" height ="200" id ="myCanvas" > </ canvas >
< script >
let ctx = document.getElementById("myCanvas" ).getContext("2d" );
for (let i = 0; i < 10; i++){
for (let j = 0; j < 10; j++){
ctx.fillStyle = `hsl( ${i*36} ${100} ${(j+1)*9})`
ctx.fillRect(i*20,j*20,(i+1)*20,(i+1)*20);
}
}
</ script >
< img src ="shape.svg" usemap ="#map" >
<!-- Create a clickable area in image -->
< map name ="map" >
< area shape ="rect" coords ="20 20 60 60" href ="url" >
< area shape ="circle" coords ="100 100 40" href ="url" >
</ map >
< input type ="hidden" >
< details >
< summary > Details Tag</ summary >
< p > You can hide content under a dropdown.</ p >
</ details >
You can hide content under a dropdown.
<!-- Add/Remove "open" to toggle the dialog -->
< dialog open >
< p > Dialog is a pop up sub-window.</ p >
</ dialog >
Dialog is a pop up sub-window.
< template > </ template >
(Template is a container of HTML fragment)
(Use Javascript to clone there fragment and insert them into the DOM tree to display them.)
<!-- Link CSS file -->
< link rel ="stylesheet" href ="style.css" >
<!-- Add CSS file -->
< style >
h1 { color:red; }
</ style >
<!-- Add Javascript file -->
< script src ="code.js" > </ script >
<!-- Add Javascript code -->
< script >
console.log("Hello World!")
</ script >
< noscript > Alternative text if javascript is not supported </ noscript >
<!-- All MathML XML tag is allowed -->
< math >
< mi > y</ mi > < mi > =</ mi > < mi > 2</ mi > < mi > x</ mi >
</ math >
<!-- All SVG XML tag is allowed -->
< svg >
< circle cx ="40" cy ="40" r ="30" fill ="coral" />
</ svg >
< meta name ="description" content ="This is an example of a meta description" >
< meta name ="keywords" content ="HTML,cheatsheet,website" >
< meta name ="author" content ="John Doe" >
< meta name ="viewport" content ="width=device-width, initial-scale=1.0" > (HTML viewport key-value pair)
< meta name ="application-name" content ="My Web App" >
< meta name ="generator" content ="WordPress 5.8" >
< meta name ="theme-color" content ="#FFFFFF" >
< meta name ="referrer" content ="no-referrer" >
< meta name ="color-scheme" content ="light dark" > (HTML color scheme name)
< meta http-equiv ="content-type" content ="text/html; charset=UTF-8" > (MIME Type)
< meta http-equiv ="content-security-policy" content ="default-src 'self'" > (HTML content security policy)
< meta http-equiv ="default-style" content ="my_style.css" >
< meta http-equiv ="refresh" content ="30" >
< meta property ="og:title" content ="Example Title" >
< meta property ="og:description" content ="This is the website description" >
< meta property ="og:image" content ="https://cheatsheet.com/image.jpg" >
< meta property ="og:url" content ="https://cheatsheet.com/page.html" >
< meta property ="og:type" content ="website" >
(more open graph tags ...)
< link rel ="stylesheet" href ="styles.css" >
< link rel ="icon" href ="favicon.ico" >
< link rel ="alternate" href ="https://example.com/fr" hreflang ="fr" >
< link rel ="preload" href ="main.js" as ="script" >
(more rel values ...)
id class title tabindex nonce style data-*
contenteditable autocapitalize autofocus spellcheck inputmode accesskey enterkeyhint
draggable hidden popover lang dir translate inert
exportparts part slot
itemprop itemid itemref itemscope itemtype
onclick ondblclick onmousedown onmousemove onmouseout onmouseover onmouseup onmousewheel onscroll onwheel
ondrag ondrop ondragenter ondragleave ondragover ondragstart
onblur onchange oncontextmenu onfocus oninput oninvalid onselect
oncopy oncut onpaste onkeydown onkeypress onkeyup
autoplay controls controlslist crossorigin disableremoteplayback height loop muted preload src width
onplay onpause onsuspend ontimeupdate onvolumechange onratechange onplaying onwaiting onended
oncanplay oncanplaythrough ondurationchange onloadeddata onloadedmetadata onloadstart onprogress onseeked onseeking
onemptied onstalled onabort onerror
download href hreflang ping referrerpolicy rel target type
alt coords download href hreflang ping referrerpolicy rel shape target
onafterprint onbeforeprint onbeforeunload onblur onerror onfocus onhashchange onlanguagechange onload onmessage onmessageerror onoffline ononline onpageswap onpagehide onpagereveal onpageshow onpopstate onresize onrejectionhandled onstorage onunhandlerejection onunload
autofocus disabled form formaction formenctype formmethod formnovalidate formtarget name popovertarget popovertargetaction type value
href target
cite
height width
span
value
cite datetime
open ontoggle name
open
disabled form name
accept-charset action autocapitalize autocomplete enctype method novalidate name onreset onsubmit rel target
xmls
alt crossorigin decoding elementtiming fetchpriority height ismap loading onabort onerror onload referrerpolicy sizes src srcset usemap width
accept alt autocomplete autofocus capture checked dirname disabled form formaction formenctype formmethod formnovalidate formtarget height list max maxlength min minlength multiple name onload onsearch pattern placeholder popovertarget popovertargetaction readonly required size src step type value width
cite datetime
allow allowfullscreen height loading name referrerpolicy sandbox src srcdoc width
for form
value
as blocking crossorigin disabled fetchpriority href hreflang imagesizes imagesrcset integrity media onload referrerpolicy rel sizes title type
name
charset content http-equiv name
form high low max min optimum value
reversed start type
disabled label
disabled label selected value
for form name
max value
cite
async blocking crossorigin defer fetchpriority integrity nomodule nonce onerror onload referrerpolicy src type
autocomplete autofocus disabled form multiple name required size
name
height media sizes src srcset type width
blocking media nonce type
colspan headers rowspan
shadowrootmode shadowrootclonable shadowrootdelegatesfocus
autocapitalize autocomplete autocorrect autofocus cols dirname disabled form maxlength minlength name placeholder readonly required rows spellcheck wrap
colspan headers rowspan scope
datetime
default kind label oncuechange src srclang
disablepictureinpicture playsinline poster
"audio/*" "video/*" "image/*" [.File Types]
[Character Encoding]
[Keyboard Key]
[Backend URL]
[Permission Policy Syntax]
string
"audio" "document" "embed" "fetch" "font" "image" "object" "script" "style" "track" "video" "worker"
[Javascript File]
"on" "off" "words" "characters"
"on" "off" [Auto Fill Detail Tokens]
boolean
boolean
[character encoding]
boolean
[URL]
string
int
int
(see HTML head section)
boolean
boolean
rectangle: x1,y1,x2,y2 circle: x,y,r polygon: x1,y1,x2,y2,...,xn,yn
"anonymous" "use-credentils" ""
string
[ISO8601 time format] (eg. YYYY-MM-DDThh:mm:ssTZD)
"sync" "async" "auto"
boolean
boolean
"ltr" "rtl" "auto"
"{HTML name}.dir" "rtl" "ltr"
boolean
boolean
boolean
[MIME type]
"enter" "done" "go" "next" "previous" "search" "send"
"high" "low" "auto"
{HTML id}
{HTML id}
[backend URL]
"application/x-www-form-urlencoded" "multipart/form-data" "text/plain"
"get" "post "dialog"
boolean
"_self" "_blank_" "_parent" "_top"
{HTML id}
int
boolean
int
[URL]
[ISO 639-1 language code]
(see HTML head section)
string
[hash algorithm]-[hash key] (eg. sha256-A591A6D40BF...)
boolean
"none" "text" "decimal" "numeric" "tel" "search" "email" "url"
boolean
string
string
string
boolean
string
"subtitles" "captions" "chapters" "metadata"
string
[ISO 639-1 language code]
"lazy" "eager"
{HTML id}
boolean
int
int
int
[media query]
"post" "get" "dialog"
int
int
boolean
boolean
string
boolean
[Javascript function]
boolean
int
[regular expression]
[URL]
string
boolean
boolean
{HTML id}
"show" "hide" "toggle"
[image URL]
"auto" "metadata" "none"
boolean
"alternate" "author" "bookmark" "canonical" "dns-prefetch" "external" "expect" "help" "icon" "license" "manifest" "me" "modulepreload" "next" "nofollow" "noopener" "noreferrer" "opener" "pingback" "preconnect" "prefetch" "preload" "prerender" "prev" "privacy-policy" "search" "stylesheet" "tag" "terms-of-service"
"no-referrer" "no-referrer-when-downgrade" "origin" "origin-when-cross-origin" "same-origin" "strict-origin""strict-origin-when-cross-origin" "unsafe-url"
boolean
boolean
[WAI-ARIA role]
int
int
"allow-downloads" "allow-forms" "allow-modals" "allow-orientation-lock" "allow-pointer-lock" "allow-popups" "allow-popups-to-escape-sandbox" "allow-presentation" "allow-same-origin" "allow-scripts" "allow-top-navigation" "allow-top-navigation-by-user-activation" "allow-top-navigation-to-custom-protocols"
"row" "col" "rowgroup" "colgroup"
boolean
"rect" "circle" "poly" "default"
int
[media condition] "int x int"
{HTML name}
int
boolean
[file URL]
[HTML code]
[ISO 639-1 language code]
[image URL]
int
int
[CSS code]
int
"_self" "_blank" "_parent" "_top" "_unfencedTop"
string
"yes" "no"
"yes" "no"
"button" "checkbox" "color" "date" "datetime-local" "email" "file" "hidden" "image" "month" "number" "password" "radio" "range" "reset" "search" "submit" "tel" "text" "time" "url" "week"d
"a" "A" "i" "I" '1"
"module" "importmap" [MIME Type]
[MIME Type]
{#HTML name}
string
int
int
"soft" "hard"