html – margin for responsive layout

Question:

I can’t understand one simple thing – in what units you need to set the size of the indents ( margin and padding ) for a responsive layout.
Everywhere I see different things: some set in px others in % or rem . How to understand what is right and how to do it?

Answer:

1vw and 1vh are the most convenient options. vw – 1% of window width, vh – window height. With the help of them, we adjust the element to the desired place; on other screens, the element will fit into the desired place.

Scroll to Top