Which units are best to use when adaptive layout?

In fact, when verse from .psd, making 2 versions of the pages (i.e. mobile and desktop) which units should I use?

As I understand it, for all padding it is better to use percentages.
And what with fonts and images?
June 27th 19 at 15:04
4 answers
June 27th 19 at 15:06
Solution
As I understand it, for all padding it is better to use percentages.

Ask the designer if they can't understand.
If the idea of indentation depends on the width of the block, then Yes, interest. If the size of the font, em, or ex. If it is constant, the pixels.

And what with fonts and images?

Similarly.
June 27th 19 at 15:08
em or rem.
their principle is that they are calculated relative to the parent font-size, i.e. at a certain breakpoint, you can specify the parent font-size is 16px - 14px and the font size is automatically recalculated.

the differences between rem and em is that em is relative to the nearest
parent in the DOM (ie, to the "l" is "ul") and rem is a relatively "html", so I prefer to use REM

here's a demo: https://codepen.io/deluxive/pen/nkHax
a rem is a relatively

Missed the "root" (html) ;) - Webster_Hean commented on June 27th 19 at 15:11
: wrote his tag, and he was sparsely((
thanks - corrected - Jonathon84 commented on June 27th 19 at 15:14
: tags use the <code></code>. In the editor under the dot :) - Webster_Hean commented on June 27th 19 at 15:17
June 27th 19 at 15:10
June 27th 19 at 15:12
if you divide the page into components, then the font size component is given in rem, and everything else in em.
see example
I used rem to set the font size of the component. The sizes of child elements of a component should depend on the font size of the component itself, not the root element, so within the component all inem.
Why do we do it? Just change the value offont-size class .card__card_big

Find more questions by tags HTMLCSS