Answer the question
In order to leave comments, you need to log in
How to set vertical padding in responsive design?
There is a layout, I decided to make it adaptive. I ran into the following problem, in what units should I set the vertical margins and height of the elements (margin, padding)? Leave in px or in %? But unlike the width, which can be set to a maximum, the height of the layout will be different and inconsistent? Or perhaps in em? Everywhere is done differently, is there any technique? And what about absolutely positioned elements, since they "slide" relative to the template when they are given top, left, bottom as a percentage
Answer the question
In order to leave comments, you need to log in
margin and padding take percentages of the parent 's width .
And what to set vertical indents - depends on the situation. In the more or less standard case of blocks with text, for example, it is more logical to set them in em, since these indents serve the correct vertical rhythm, which largely depends on text styles.
Also, use rem instead of em, they are now supported wherever media queries are supported .
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question