Resources
Tutorial by Dave Gray
Free YouTube Tutorial.
"Keep striving for progress, not perfection. And a little progress every day goes a very long way." - Dave Gray
Full Notes on Notion.
Free YouTube Tutorial.
"Keep striving for progress, not perfection. And a little progress every day goes a very long way." - Dave Gray
CSS, mainly used for HTML although possible to use for XML.
Three ways to apply style:
Final defined styles will override the previous one.
The previous one will only be persisted when specified as `!important`, which should be
prevented most of the time, as the code should have designed properly without overrules.
Validation can be done on w3c website by uploading the CSS files.
Three common levels of selector:
body {
border: 1px solid #111;
font-size: 20px;
}
All the child of body inherits the font-size but not the border, the behaviours are by default.
Use the Inheritance to make sure the codes are DRY (Don't Repeat Yourself).
Four main ways to set colours (especially for <color> and <background>):
Make sure colour contrasts are good through coolors.co.
Everything in CSS is a box.
All elements are built from 4 parts:
Every element can be inspected (F12), and the 4 parts will be shown under computed.
Every part can have their top, right, bottom and left values set seperately, e.g.:
margin: top, right, bottom, left;
Many elements have some default `em` margins and paddings, if want to get rid of all those to take full control, a CSS reset can be used:
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
The way a text is arranged and presented (font).
Remember `rem` is the preferable way to set font size.
Some elements do not inherit parent's font settings by default, it can be set through `font: inherit;`.
Some attributes that have default special values:
Some states (more specificity):
Important attributes:
li:nth-child(even) {
...
}
ul li::marker {
...
content: "Prefix... ";
}
Display Types: