Mdo Code Guide
Programming
开发一致的、灵活的、sustainable(可持久的) 的 HTML 和 CSS。
黄金法则
强化既有规则,在任何时候都遵循这些规则。在小项目和大项目中寻找错误。
Every line of code should appear to be written by a single person, no matter the number of contributors.
不论贡献者多少,确保自己审核过每一行代码。
HTML
语法
- 不要大写标签,包括 doctype(<mark>为什么?)。
- 使用两个空格的软制表符——这样能保证代码在任何环境下格式都一致。
- 嵌套元素彼此应缩进一次(两个空格)。
- 总是在属性上使用双引号。
- 不要在自闭和标签上加反斜线(
/)——[HTML5 标准](https://html.spec.whatwg.org/multipage/syntax.html#start-tags)说这是可选项。 - 不要省略可选的闭合标签(比如,
</li>或</body>)。
```html <!doctype html> <html> <head> <title>Page Title<body> <img src="images/logo.png" alt="logo"> <h1 class="hello-world">Hello, World!