时间:2021-07-01 10:21:17 帮助过:16人阅读
Bad:
...
Good:
...
Bad:
Good:
Bad:
Good:
Bad:
Copyright © 2014 W3C®
Good:
Copyright © 2014 W3C®
###Escape &, <, >, ", and ' 可以用字符引用
Bad:
The "&" character
Good:
The "&" character
Bad:
This book can read in 1 hour.
Good:
This book can read in 1 hour.
Bad:
Good:
Bad:
...
Good:
...
Bad:
Good:
Bad:
HTML Best Practices
Good:
HTML Best Practices
Bad:
General
Good:
General
Bad:
Good:
Don't separate attributes with two or more white spaces
Bad:
Good:
Bad:
Good:
Bad:
Good:
Bad:
...
Good:
...
Bad:
Good:
Bad:
Good:
Bad:
Good:
Bad
Good:
Bad:
Good:
HTML Best Practices
Bad:
Good:
Bad:
Good:
把 favicon.ico 放在根目录
Bad:
Good:
Bad:
HTML Best Practices
Good:
HTML Best Practices
Bad:
Good:
Bad:
...
Good:
...
Bad:
Good:
Bad:
Good:
Bad:
Good:
Bad:
Good:
Also good:
Bad:
... ...
Good:
... ...
Bad:
HTML Best Practices
For writing maintainable and scalable HTML documents.
Good:
HTML Best Practices
For writing maintainable and scalable HTML documents.
Bad:
No rights reserved.
Good:
Contact: Kyo Nagashima
Bad:
<!DOCTYPE html>
Good:
<!DOCTYPE html>
Bad:
For writing maintainable and scalable HTML documents.
Good:
For writing maintainable and scalable HTML documents.
Bad:
For writing maintainable and scalable HTML documents.
— HTML Best Practices
Good:
For writing maintainable and scalable HTML documents.
— HTML Best Practices
Also good (recommended by WHATWG):
Also good too (recommended by W3C):
For writing maintainable and scalable HTML documents.
Bad:
Good:
Bad:
- General
- The root Element
- Sections
...
Good:
- General
- The root Element
- Sections
...
Bad:
Good:
Bad:
...
Good:
...
Bad:
...
Good:
... Text-level semantics
Bad:
WHATWG
A community maintaining and evolving HTML since 2004.
Good:
WHATWG
A community maintaining and evolving HTML since 2004.
Bad:
offline version
Good:
offline version
Bad:
Japanese PDF version
Good:
Japanese PDF version
Bad:
Click here to view PDF version.
Good:
PDF version is also available.
Bad:
Caution!
Good:
Caution!
Bad:
Good:
Bad:
“For writing maintainable and scalable HTML documents”
Good:
For writing maintainable and scalable HTML documents
Also good:
“For writing maintainable and scalable HTML documents”
Bad:
HBP
Good:
HBP
Bad:
HTML
Good:
HTML
Bad:
Good:
Specify code language with class attribute prefixed with language-
Bad:
<DOCTYPE html>
Good:
<DOCTYPE html>
Bad:
Ctrl+F5
Good:
Ctrl+F5
Bad:
HTML Best Practices
Good:
HTML Best Practices
Bad:
HTML
Best
Practices
Good:
HTML
Best
Practices
Bad:
Good:
Bad:
For writing maintainable and scalable HTML documents.
And for mental stability.Don't trust!
Good:
For writing maintainable and scalable HTML documents.
And for mental stability.Don't trust!
Bad:
Good:
Bad:
Good:
Bad:
Good:
Bad:
Good:
Bad:
Good:
Bad:
Good:
Bad:
General The root Element Sections
Good:
General The root Element Sections
Bad:
Element | Empty | Tag omission |
pre | No | Neither tag is omissible |
img | Yes | No end tag |
Good:
Element | Empty | Tag omission |
---|---|---|
pre | No | Neither tag is omissible |
img | Yes | No end tag |
Bad:
Query:
Good:
Bad:
Good:
Bad:
Good:
Bad:
Good:
Bad:
Good:
Bad:
Good:
Bad:
Good:
Bad:
Good:
Bad:
512GB used (1024GB total)
Good:
512GB used (1024GB total)
Bad:
Good:
Bad:
Good:
Bad:
Good:
Bad:
Also bad:
Good:
Bad:
Good:
Bad:
... ...
Good:
... ...
原文出处:https://github.com/dyygtfx/html-best-practices