Title: Theory / Unimportant / CS / Descriptive / Web / HTML; / StyleGuide
On every note of this deck, unless a note says otherwise:
Page: https://google.github.io/styleguide/htmlcssguide.html

Question: To which part of HTML styleguide applies
Answer: Code written by developer, not result of compilation, minification or obfuscation
Context: html

Question: Which protocol to use for media files
Answer: https, explicitly
Context: html

Question: Which protocol to use for style sheets
Answer: https, explicitly
Context: html

Question: Which protocol to use for scripts file
Answer: https, explicitly
Context: html

Question: How much to indent html
Answer: 2 spaces at a time
Context: html

Question: How much to indent css
Answer: 2 spaces at a time

Question: How to capitalize tag name
Answer: all lower case
Chapter: 2
Section: 2.2
Context: html

Question: How to capitalize attributes
Answer: all lower case
Chapter: 2
Section: 2.2
Context: html

Question: How to capitalize attributes values
Answer: all lower case, except for text/CDATA
Chapter: 2
Section: 2.2
Context: html

Question: How to capitalize selector
Answer: all lower case
Chapter: 2
Section: 2.2
Context: css

Question: How to capitalize properties
Answer: all lower case
Chapter: 2
Section: 2.2
Context: css

Question: How to capitalize property values
Answer: all lower case
Chapter: 2
Section: 2.2
Context: css

Question: Are trailing whitespaces acceptable
Answer: no
Chapter: 2
Section: 2.3
Context: html/css

Question: Which encoding to use
Answer: UTF-8 with no byte order mark <meta charset="utf-8"/>
Chapter: 2
Section: 3
Context: html/css

Question: How to create TODO in hmtl
Answer: <!-- TODO: what to do -->
Chapter: 2
Section: 3.2
Context: html

Question: How to create TODO in css
Answer: {# TODO(who): what to do #}
Chapter: 2
Section: 3.2

Question: Which version of HTML to use
Answer: html5
<!DOCTYPE html>
not xhtml
Chapter: 3
Section: 1.1

Question: Should you close void elements, e.g. br
Answer: don't close. <br>
Chapter: 3
Section: 1.1

Question: What to do when using media
Answer: use alt proprety. use alt="" if it's purely decorative
Chapter: 3
Section: 1.3

Question: What to do if there are multiple CSS files needed
Answer: Import them from a single css file you import from html page
Chapter: 3
Section: 1.5

Question: Which entity reference to use
Answer: Only the ones for <, & and invisible characters
Chapter: 3
Section: 1.6

Question: What to do with optional tag
Answer: Omit them
Chapter: 3
Section: 1.7

Question: When to add type for style/script
Answer: only if not default. E.g. not css/js
Chapter: 3
Section: 1.8

Question: Constraints on `id` attributes
Answer: Avoid, uses class/data if possible
Chapter: 3
Section: 1.9
Answer2: Otherwise put a hyphen in the value so that it does not match js identifier syntax

Question: Which element requires a new line
Answer: block
Chapter: 3
Section: 2
Answer2: list
Answer3: table

Question: What is the recommended size of html line
Answer: unlimited if readable
Chapter: 3
Section: 2.2

Question: Indentation of html line-wrapped
Answer: 4 more spaces than the original line
Chapter: 3
Section: 2.2

Question: How to quote attributes values
Answer: Uses double quote only
Chapter: 3
Section: 2.3

Question: How should class name be
Answer: Uses names that specifically describe the element, or a generic name
Chapter: 4
Section: 1
Context: css
Answer2: Use a name as short as possible but as long as necessary
Answer3: Separate words with hyphen
Answer4: For large project, uses prefix as namespace

Question: How should class name be used
Answer: By themselves, not applied to a selector, unless necessary
Chapter: 4
Section: 1.6
Context: css

Question: Should you use id selector
Answer: No.
Chapter: 4
Section: 1.7
Context: css

Question: Should you use shortand properties
Answer: Yes, as much as possible
Chapter: 4
Section: 1.6
Context: css

Question: Should you indicates unit of measures
Answer: Yes, unless for 0, unless necessary
Chapter: 4
Section: 1.9
Context: css

Question: How to write numbers between -1 and 1
Answer: Start the number with "0."
Chapter: 4
Section: 1.10
Context: css

Question: How to write hexadecimal notation
Answer: Use three characters when possible
Chapter: 4
Section: 1.11
Context: css

Question: How to use !important
Answer: Avoid. Using  selector specificity instead
Chapter: 4
Section: 1.12
Context: css

Question: How to detect agent
Answer: Avoid unless necessary
Chapter: 4
Section: 1.13
Context: css

Question: In which order should declaration be
Answer: Alphabetical, ignoring vendor-specific prefixes for sorting purpose
Chapter: 4
Section: 2.1
Context: css

Question: Should you use a semicolon after declarations
Answer: always
Chapter: 4
Section: 2.3
Context: css

Question: How to format propertie name/value
Answer: no space before column, one after.
margin-top: 1em;
Chapter: 4
Section: 2.4
Context: css

Question: How to format selector/block
Answer: selector {
  ...
}
Single space, no new line
Chapter: 4
Section: 2.5
Context: css

Question: How to format multiple selector for a single declaration
Answer: h1,
h2,
h3 {
 ...
}
New line after each selector except the last one
Chapter: 4
Section: 2.6
Context: css

Question: How to separate rules
Answer: Put an empty line between each rule
html {
  background: #fff;
}
body {
  margin: auto;
  width: 50%;
}
Chapter: 4
Section: 2.7
Context: css

Question: How to use url
Answer: Don't use quote
url(https://www.google.com)
Chapter: 4
Section: 2.8
Context: css

Question: How to quote value
Answer: Use single quote, no double
Chapter: 4
Section: 2.8
Context: css

Question: How to order sections
Answer: Group style by section, separating by a comment
Chapter: 4
Section: 3
Context: css