HTML
Ref
HTML Intro
block elements: take a whole line.
inline elements: no new line.
Tags are case insensitive. <img> is the same as <IMG>.
Attributes are case insensitive. onclick is the same as onClick. Usually values are in double quotes.
HTML ignores indentation and newlines.
Browser combines multiple whitespaces, \t, \n, \r.
<meta>
URL Intro
18 characters are reserved: they can only appear at certain places in URL. If those characters are used elsewhere in URL, they need to be escaped (% + ASCII code). Encoding other characters are not recommended.
space:%20!:%21#:%23$:%24&:%26':%27(:%28):%29*:%2A+:%2B,:%2C/:%2F::%3A;:%3B=:%3D?:%3F@:%40[:%5B]:%5D
Other characters (not reserved, not legal) will be encoded to UTF-8 by browser (汉字).
Attributes
data- attributes can be used by CSS or JavaScript. CSS example:
event handler: values are JavaScript code. Keys:
onabort, onautocomplete, onautocompleteerror, onblur, oncancel, oncanplay, oncanplaythrough, onchange, onclick, onclose, oncontextmenu, oncuechange, ondblclick, ondrag, ondragend, ondragenter, ondragexit, ondragleave, ondragover, ondragstart, ondrop, ondurationchange, onemptied, onended, onerror, onfocus, oninput, oninvalid, onkeydown, onkeypress, onkeyup, onload, onloadeddata, onloadedmetadata, onloadstart, onmousedown, onmouseenter, onmouseleave, onmousemove, onmouseout, onmouseover, onmouseup, onmousewheel, onpause, onplay, onplaying, onprogress, onratechange, onreset, onresize, onscroll, onseeked, onseeking, onselect, onshow, onsort, onstalled, onsubmit, onsuspend, ontimeupdate, ontoggle, onvolumechange, onwaiting
HTML character encoding
entity: &name;
<:<>:>":"':'&:&©:©#:#§:§¥:¥$:$£:£¢:¢%:%*:$ast;@:@^:^±:±空格:
HTML tags
<header><footer><main><article><aside><section><nav><h1>~<h6><hgroup>
Text tags
<br>: for inline elements
<strong> <b>
<em> <i> (emphasize)
<sub> <sup> <var> (variable in math formula)
<u> underline <s> strikethrough
<blockquote> <cite> <q>
<ins>标签是一个行内元素,表示原始文档添加(insert)的内容。<del>与之类似,表示删除(delete)的内容。它们通常用于展示文档的删改。<small>: no need for CSS.
<mark>: for highlight.
<ruby> for pinyin https://wangdoc.com/html/text.html#ruby
Table tags
<ol>: attributes: reversed, start="5", type
type属性指定数字编号的样式。目前,浏览器支持以下样式。a:小写字母A:大写字母i:小写罗马数字I:大写罗马数字1:整数(默认值)
<li>: value
Image
responsive image https://wangdoc.com/html/image.html
Link
<a> can have
mailto:as href.<link>: rel="stylesheet" relation
Other tags
New tags
<dialog>: native modal
<details> <summary>
Last updated
Was this helpful?