different position values:
→ static -
default
- element will stick to the normal page flow,
so left/right/top/bottom/z-index - NA
→ relative -
it really means “relative to itself”
- element will remain in normal page flow,
but now left/right/top/bottom/z-index will work,
relative to where it would have been if the positional property wouldn’t have been applied - z-index gets added
→ absolute -
the element is removed from the flow of the document and other elements will behave as if it’s not even there - left/right/top/bottom/z-index will work
→ fixed -
just like absolute
- only difference - fixed positioned elements are always relative to the document, not any particular parent, and are unaffected by scrolling
→ sticky -
the element is treated like a relative value until the scroll location of the viewport reaches a specified threshold, at which point the element takes a fixed position
→ inherit -
inherit the positioning value from its parent
positional properties:
z-index -
any of the valid CSS unit (px, rem, vw, vh etc)
a percentage of the of the containing element’s height (for top and bottom) or width (for left and right)
Selectors in CSS
color can be added in 4 ways:
Selectors in CSS
Selectors in CSS
Selectors in CSS
Selectors in CSS
ch
- character
- equal to the width of a character in the used font,
rem
- "root em",
px
- pixel,
number
- used for: line-height, opacity,
percentage -
For example, width is calculated as a percentage of the available width in the parent element.
deg - degree
used for rotational properties.
transform: rotate(80deg)
Numbers, Lengths and Percentage
Relative
Lengths
Selectors in CSS
Numbers, Lengths and Percentage
Selectors in CSS
Relative
Lengths
Selectors in CSS
Relative
Lengths