HTML
Last updated
Last updated
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.
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 (汉字).
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
entity: &name;
<
:<
>
:>
"
:"
'
:'
&
:&
©
:©
#
:#
§
:§
¥
:¥
$
:$
£
:£
¢
:¢
%
:%
*
:$ast;
@
:@
^
:^
±
:±
空格:
<header>
<footer>
<main>
<article>
<aside>
<section>
<nav>
<h1>
~ <h6>
<hgroup>
<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
<ol>: attributes: reversed, start="5", type
type
属性指定数字编号的样式。目前,浏览器支持以下样式。
a
:小写字母
A
:大写字母
i
:小写罗马数字
I
:大写罗马数字
1
:整数(默认值)
<li>: value
responsive image https://wangdoc.com/html/image.html
<a> can have mailto:
as href.
<link>: rel="stylesheet" relation
New tags
<dialog>: native modal
<details> <summary>