1、Protocol(协议)
Use HTTPS for embedded resources where possible.
在可能的情况下,将HTTPS用于嵌入式资源。
Always use HTTPS (https:) for images and other media files, style sheets, and scripts, unless the respective files are not available over HTTPS.
对于图像和其他媒体文件、样式表和脚本,始终使用HTTPS(https:),除非各自的文件在HTTPS上不可用。
2、eneral Formatting Rules(通用格式规则)
2.1 Indentation(行首缩进)
Indent by 2 spaces at a time.
每次缩进两个空格。
Don’t use tabs or mix tabs and spaces for indentation.
不要使用制表符或混合制表符和空格进行缩进。
2.2 Capitalization(资本化)
Use only lowercase.
只使用小写。
All code has to be lowercase: This applies to HTML element names, attributes, attribute values (unless text/CDATA), CSS selectors, properties, and property values (with the exception of strings).
所有代码都必须是小写:这适用于HTML元素名称、属性、属性值(除非文本/CDATA)、CSS选择器、属性和属性值(字符串除外)。
2.3 Trailing Whitespace(尾随空白)
Remove trailing white spaces.
移除尾随的空白。
Trailing white spaces are unnecessary and can complicate diffs.
尾随的空白是不必要的,可能会使差异复杂化。
2.4 General Meta Rules(一般元规则)
2.3.1 Encoding(编码)
Use UTF-8 (no BOM).
使用UTF-8(无BOM)
Make sure your editor uses UTF-8 as character encoding, without a byte order mark.
确保编辑器使用UTF-8作为字符编码,没有字节顺序标记。
通过<metacharset=”utf-8”>在HTML模板和文档中指定编码。不要指定样式表的编码,因为它们假定为UTF-8。
(More on encodings and when and how to specify them can be found in Handling character encodings in HTML and CSS.)
(在HTML和CSS中处理字符编码时,可以找到更多关于编码以及何时和如何指定它们的信息。)
2.3.2 Comments
Explain code as needed, where possible.
在可能的情况下,根据需要解释代码。
Use comments to explain code: What does it cover, what purpose does it serve, why is respective solution used or preferred?
使用注释来解释代码:它涵盖了什么,它有什么用途,为什么各自的解决方案被使用或首选?
Append a contact (username or mailing list) in parentheses as with the format TODO(contact).
在括号中添加联系人(用户名或邮件列表),格式为Todo(联系人)。
Append action items after a colon as in TODO: action item.
在冒号后追加操作项,如Todo:action项中的。
————————————————
版权声明:本文为优快云博主「weixin_51297712」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.youkuaiyun.com/weixin_51297712/article/details/109371861