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

后端 未结 19 1526
情话喂你
情话喂你 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:52

    See this CodePen https://codepen.io/ella301/pen/vYLNmVg which I created. I used 3 CSS functions min, max and calc to make sure the left and right paddings are fluid between minimum 20px and maximum 120px.

     padding: 20px max(min(120px, calc((100% - 1198px) / 2)), 20px);
    

    Hope it helps!

提交回复
热议问题