qiangc.net

HTML document

The basic structure of adocument <!DOCTYPE html> <html> <head> <title>title</title> <head> <body> <p> Hello, world! </p> </body> <html>

Comment

<!-- comment -->

head

<head> <title>title</title> <meta /> <link /> <style /> <script /> <head>

body

<body> <header> <article /> <section /> <h1 /> <p /> <span /> <footer /> <body>

Main

The main content of a document <body> <main /> </body>

Header / Footer

For document or section <header /> <footer /> <!DOCTYPE> <html> <head> <title>title</title> <head> <body> <header /> <section> <header /> <footer /> </section> <footer /> </body> <html>

Table

For tabula data display <table> <caption></caption> <colgroup> <col /> </colgroup> <thead> <th></th> </thead> <tbody> <tr> <td></td> </tr> </tbody> <tfoot></tfoot> </table>

List

List can be nested to create hierarchical tree display

Unordered list

<ul> <li></li> </ul>

Ordered list

<ol> <li></li> </ol>

Description list

<dl> <dt></dt> <dd></dd> </dl>

Graphic

Image

<img src="sample.jpg" alt="sample">

Figure

<figure> <img src="sample.jpg" alt="sample"> <figcaption /> </figure>

Drawing

SVG

<svg />

Canvas

<canvas />

Global Attributes

apply to all tags

accesskey autocapitalize class contenteditable contextmenu data-* dir draggable dropzone hidden id itemprop lang slot spellcheck style tabindex title translate

Input Attributes

<input>

accept alt autocomplete autofocus checked dirname disabled form formaction height list max maxlength min minlength multiple name pattern placeholder readonly required size src step type usemap value width

Textarea Attributes

<textarea>

autocomplete autofocus cols dirname disabled form maxlength minlength name placeholder readonly required rows width

Form Attributes

<form>

accept accept-charset action autocomplete enctype method name novalidate target

Global Events

apply to all tags

onautocomplete onautocompleteerror onblur onchange onclick onclose oncontextmenu ondblclick ondrag ondragend ondragenter ondragexit ondragleave ondragover ondragstart ondrop onfocus oninput oninvalid onkeydown onkeypress onkeyup onmousedown onmouseenter onmouseleave onmousemove onmouseout onmouseover onmouseup onmousewheel onscroll onselect

Mouse Events

onclick ondblclick ondrag ondragend ondragenter ondragexit ondragleave ondragover ondragstart ondrop onmousedown onmouseenter onmouseleave onmousemove onmouseout onmouseover onmouseup onmousewheel onscroll

Key Events

onkeydown onkeypress onkeyup

Window Events

onerror onload onresize

Form Events

onblur onchange oncontextmenu onfocus oninput oninvalid onreset onselect onsubmit

<form>

onsubmit

Media Events

<audio>, <video>

onabort oncanplay oncanplaythrough oncuechange ondurationchange onemptied onended onloadeddata onloadedmetadata onloadstart onpause onplay onplaying onprogress onratechange onseeked onseeking onstalled onsuspend ontimeupdate onvolumechange onwaiting

<img>

onabort

Other Events

<embed>, <object>

onabort oncanplay