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

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

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

19条回答
  •  Happy的楠姐
    2021-01-31 01:33

    Comming late to the party, as said above there unfortunately is no such thing as max-margin. A sollution that helped me is to place a div above the item you want to have the max-margin applied to.

    
        
    Hello World!

    Run above coded snippet in full page and resize the window to see this working. The lightgreypart will have the margin-top of 50% and a 'min-margin-top' of 200px. This margin is the red div (wich you can hide with display: none; if you want to). The blue part is what's left of the body.

    I hope this will help people with the same problem in the future.

提交回复
热议问题