Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.39 KB | None | 0 0
  1. # CSS #
  2.  
  3. 01. Capitalization rules:
  4.  
  5. 1. Generally, HTML element names should be lowercase.
  6. This is important for compatibility with XHTML.
  7. For scripts directly embedded into an HTML document, uppercase names *may* be used instead, but this makes the stylesheet harder to copy­‑paste.
  8.  
  9. 2. At­‑rules should also be lowercase.
  10.  
  11. 3. IDs and class names should match the source (naturally).
  12.  
  13. 4. Pseudo­‑selectors, property names, and function names should be `Capitalized`.
  14.  
  15. 5. `<color>` values should be `CamelCase`.
  16.  
  17. 6. Units (`PX`, `EM`, etc) and pseudo-elements (`::BEFORE`, etc) should be `UPPERCASE`.
  18.  
  19. 7. A property may be marked important like so: `Text-Indent: 0 ! IMPORTANT`.
  20.  
  21. 02. Decimal numbers should not have a leading zero (eg, `.02EM` not `0.02EM`) and units should follow immediately after.
  22.  
  23. 03. There should not be spaces within or between selectors (eg, `section>p` not `section > p`).
  24. Avoid quotes where unnecessary (`[role=note]` not `[role="note"]`).
  25.  
  26. 04. `*` or `*|*` should always be used in selectors with no specified element.
  27.  
  28. 05. Tabs are preferred over spaces for indentation.
  29.  
  30. 06. A ruleset with only one declaration should be written as follows:
  31.  
  32. p { Text-Indent: 2EM }
  33.  
  34. A ruleset with multiple declarations should be written as follows:
  35.  
  36. p {
  37. Margin: 0;
  38. Text-Indent: 0;
  39. }
  40.  
  41. Inside of the `style` attribute, declarations should be written as `Margin: 0; Text-Indent: 0` (with no final semicolon).
  42.  
  43. 07. Rulesets should be written on successive lines.
  44. When multiple selectors are being matched, each should be given its own line, like follows:
  45.  
  46. li,
  47. p { Margin: 0 }
  48. ol,
  49. ul {
  50. Margin: 1EM Auto;
  51. Padding: 0 2EM;
  52. }
  53.  
  54. 08. When a property takes multiple values separated by commas, each should be given its own line, like follows:
  55.  
  56. b {
  57. Font-Weight: Bold;
  58. Text-Shadow:
  59. -1PX 1PX #FAE13E,
  60. 1PX -1PX #B01C1C;
  61. }
  62.  
  63. 09. Properties should be given in the following order, for consistency:
  64.  
  65. 1. `Display`
  66. 2. Properties specifying the writing direction
  67. 3. Properties specifying the flex and grid axes
  68. 4. `Float`, `Clear`
  69. 5. `Position`
  70. 6. Properties specifying the positioning of the box within its container (`Align-Self`, etc)
  71. 7. Offset properties (`Top`, `Bottom`, `Left`, `Right`)
  72. 8. Margin properties
  73. 9. Border properties (style, then colour, then width; in the shorthand this order is reversed)
  74. 10. Padding properties
  75. 11. Outline properties
  76. 12. `Width`, `Min-Width`, `Max-Width`, `Height`, `Min-Height`, `Max-Height`
  77. 13. `Overflow`, `Clip`, `Visibility`
  78. 14. `Vertical-Align`
  79. 15. Properties specifying the positioning of contents within the box (`Align-Items`, etc)
  80. 16. `Color`
  81. 17. `Background` (color, then image)
  82. 18. `Box-Shadow`
  83. 19. `Opacity`
  84. 20. Font properties
  85. 21. `Line-Height`, `White-Space`
  86. 22. Text properties
  87. 23. `Hyphens`
  88. 24. `Transform`
  89. 25. CSS Transitions
  90. 26. CSS Animations
  91. 27. `Z-Index`
  92. 28. `Content`
  93.  
  94. 10. Inline comments should be written `/* Like this */`.
  95. Block comments should look like this:
  96.  
  97. /*
  98. This is a block comment.
  99. It contains multiple sentences.
  100. */
  101.  
  102. Block comments should be indented to match the surrounding markup.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement