rem
stands for Relative Elastic Measurement
and is determined by the font size of the body
element. For example, if the font size on body
is 16px, then 1rem is also 16px, regardless of the element it is applied to or its own font size.
If you want a measurement that adjusts based on screen size, consider using vw
. This represents Viewport Width
and is a percentage of the screen width. For instance, 100vw
equals the full width of the screen, while 50vw
is half the screen's width.
You could utilize 5vw
for padding, ensuring more padding on larger screens and less on smaller ones:
ScreenSize 1200px:
padding: 5vw; /* results in 60px */
ScreenSize 360px:
padding: 5vw; /* results in 18px */
By keeping the padding value constant at 5vw, the actual amount of padding varies (60px and 18px) in relation to the screen size.