Margin on child element moves parent element

前端 未结 14 2201
广开言路
广开言路 2020-11-21 23:38

I have a div (parent) that contains another div (child). Parent is the first element in body with no

14条回答
  •  后悔当初
    2020-11-22 00:27

    I had this problem too but preferred to prevent negative margins hacks, so I put a

    around it all which has paddings instead of margins. Of course this means more divitis but it's probably the cleanest way to do get this done properly.

提交回复
热议问题