Fixed values cm, mm, px.
Pixels used to cause a lot of problems, as they were a fixed unit (one dot on the screen). Now, it follows the reference pixel. So not a dot on screen anymore.
<aside>
⚠️ We use calc function to do different kind of calculations in css. A better alternative can be clamp function which takes 3 values the middle value is the same as what you pass to calc()
, the opening value specifies the minimum size and the closing value specifies the maximum size.
</aside>
Depends on other things like parent etc.
Used to make the website responsive.
Units are %, em, rem, vh, vw, max-height, min-height.
There are two types of relative units.
Relative to font-size: em, rem
<aside> 💡 The root of an HTML page is always the html element.
</aside>
Relative to the viewport: vm, vh, vmin, vmax
Percentages are mainly used for widths, and are pretty easy to understand.
Font-size = rem
Padding and margin = em
Widths = em or percentage