| Index: css.md |
| =================================================================== |
| new file mode 100644 |
| --- /dev/null |
| +++ b/css.md |
| @@ -0,0 +1,46 @@ |
| + |
| +# CSS |
| + |
| +- Philosophy |
| + - Use [valid](https://jigsaw.w3.org/css-validator/) CSS where possible |
| + - Try to avoid user agent detection and CSS "hacks" |
| +- File |
| + - No mode line comments (`/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */`) |
| + - All files should have a [license header](https://adblockplus.org/license-headers) |
| +- Naming |
| + - No special CSS notation (EG: Hungarian, BEM, other prefixes or suffixes denoting type or scope) |
| + - Use meaningful or generic ID and class names |
| + - Use ID and class names that are as short as possible but as long as necessary |
| + - Avoid qualifying ID and class names with type selectors (EG: div.error) |
| + - Separate words in Id and class names by a hyphen |
| + - Group sections together by comment |
| +- Spacing |
| + - Use unix-style newlines |
| + - Use spaces instead of tabs |
| + - Use 2 spaces for indentation |
| + - Use a space after a property name’s colon |
| + - Opening braces always go on their own line. |
| + - Separate rules by new lines |
| + - Separate selectors and declarations by new lines |
| + - Indent all block content (EG: Media queries) |
| + - Line length is 80 char, except when it improves readability |
| + - No trailing whitespace |
| + - Newline at end of file |
| +- Properties |
| + - Use double quotes |
| + - Use hex colors |
| + - 3 character notation where possible |
| + - Provide units where possible (EG: 0px vs 0) |
| + - Don't omit loading 0s in decimal numbers (EG: 0.5px vs .5px) |
| + - Shorthand properties are optional |
| + - Use a semicolon after every declaration |
| + - Property sort order |
| + - Display |
| + - Positioning |
| + - Box model |
| + - Colors and Typography |
| + - Other |
| +- Comments |
| + - Use JavaDoc style comments |
| + - Don't comment code out, delete it. |
| + - Don't add TODO comments, create an issue and reference it in a comment instead. |