Cascading Stylesheets
CSS is awesome: https://repl.it/GY4b
CSS garden: http://www.csszengarden.com/
CSS puns: http://saijogeorge.com/css-puns/
CSS is awesome!
Including CSS in HTML
Including CSS
Inline: https://repl.it/GWO0/1
Including CSS
Inline:
-
slow down dev process
-
quick changes => debugging
-
email templates
-
large HTML file
https://repl.it/GWOt
Including CSS
Including CSS
External CSS (most used one):
- browser cache
- minification
- separating HTML, CSS and JS => easier to read the code, easier to develop
- reusing same style on multiple subpages
https://repl.it/GUns
Including CSS
Same code in three ways. Which one is the best?
Including CSS
Same code in three ways. Which one is going to overwrite the others?
Including CSS
Exercise 1: https://repl.it/GWWf/1
Including CSS
Exercise 2: https://repl.it/GWZq/1
CSS selectors
CSS selectors
Syntax: https://repl.it/GUUe/2
CSS selectors
Type selectors: https://repl.it/GW9i/1
CSS selectors
Type selectors 2: https://repl.it/GWi2/0
CSS selectors
Class selector: https://repl.it/G0Xf
CSS selectors
Multiple classes: https://repl.it/G0Xz
CSS selectors
ID selector: https://repl.it/GcIY
CSS selectors
ID selector: https://repl.it/GJTK/1
CSS selectors
ID or class?
Two IDs with the same style: https://repl.it/GWmr
Applying class with same style to multiple elements: https://repl.it/GWnR
CSS selectors
Attribute selector:
CSS selectors
Child selector:
CSS selectors
Descendant selector:
CSS selectors
Sibling selector:
CSS selectors
Sibling selectors must have same parent:
CSS selectors
Sibling selectors must have same parent:
CSS cascade
CSS cascade
Order of the CSS rules matter!
CSS cascade
1. importance:
CSS cascade
CSS cascade
CSS cascade
CSS cascade
CSS cascade
CSS cascade
CSS cascade
CSS cascade
3. Source order
CSS cascade
4. Exercise:
CSS
By tonkec palonkec
CSS
- 980