Why is setting the top-margin of this child element pushing its parent container down with it?

后端 未结 4 814
别跟我提以往
别跟我提以往 2020-12-17 00:22

I have two divs:

S

4条回答
  •  情话喂你
    2020-12-17 00:59

    just use box-sizing: border-box; on the parent and set the padding there instead of margin-top. It will help you keep consistent spacing on all sides anyways

    JSFIDDLE

提交回复
热议问题