Can we define min-margin and max-margin, max-padding and min-padding in css?

后端 未结 19 1492
情话喂你
情话喂你 2021-01-31 01:01

Can we define min-margin and max-margin, max-padding and min-padding in CSS ?

19条回答
  •  既然无缘
    2021-01-31 01:54

    I think I just ran into a similar issue where I was trying to center a login box (like the gmail login box). When resizing the window, the center box would overflow out of the browser window (top) as soon as the browser window became smaller than the box. Because of this, in a small window, even when scrolling up, the top content was lost.

    I was able to fix this by replacing the centering method I used by the "margin: auto" way of centering the box in its container. This prevents the box from overflowing in my case, keeping all content available. (minimum margin seems to be 0).

    Good Luck !

    edit: margin: auto only works to vertically center something if the parent element has its display property set to "flex".

提交回复
热议问题