CSS - casading style sheet
What is it?
CSS is a language for describing how documents are presented visually - how they are arranged and styled
What does it stand for?
CSS stands for Cascading Style Sheets.
CSS RULES
- (almost) everything you do in CSS follows this basic pattern
1
2
3selector{
property: value;
}
Including Style Correctly
- Inline Style: You can write your styles directly inline on each element, but this is NOT A GOOD IDEA most of the time.
- The
STYLE
element: You can write your style inside of a<style>
element. This is easy, but it makes it impossible to share styles between documents. Not recommended either - External stylesheet: Write your styles in a
.css
file, and then include the using a<link>
in the head of your html document. Recommended!
Focusing on the third method,
my_styles.css
1 | h2{ |
Demo.html
1 |
|
Demo
I am Jim
I am Cool
https://developer.mozilla.org/en-US/docs/Web/CSS/color_value
Color Systems: RGB and Named Colors
https://htmlcolorcodes.com/color-names/
https://htmlcolorcodes.com/color-picker/
A typical computer can display ~16000000 different colors
RGB
- Red, Green, Blue Channel
- Each channel ranges from
0-255
1 | h2{ |
Color Systems: Hexadecimal
Hex
- Still red, green and blue channels
- Each ranges from
0-255
BUT represented withhexadecimal
Hexadecimal
0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F
1 | 16*16 = 256 |
so, the rgb becomes -> #0f5679
Common Text Properties
https://developer.mozilla.org/en-US/docs/Web/CSS/text-align
https://developer.mozilla.org/en-US/docs/Web/CSS/font-weight
https://developer.mozilla.org/en-US/docs/Web/CSS/text-decoration
https://developer.mozilla.org/en-US/docs/Web/CSS/line-height
Font Size Basics With Pixels
Relative
- EM
- REM
- VH
- VW
- %
- AND MORE!
Absolute
- PX
- PT
- CM
- IN
- MM
PX - BY FAR THE MOST COMMONLY USED ABSOLUTE UNIT
1px does not necessarily equal the width of exactly one pixel!
Not recommended for responsive website
The Font Family Property
https://www.cssfontstack.com/
https://developer.mozilla.org/en-US/docs/Web/CSS/font-family