Child elements with margins within DIVs

后端 未结 4 881
轻奢々
轻奢々 2020-12-13 02:19

I need two consecutive div elements (with backgrounds) to be touching seamlessly, one below the other. However, this layout breaks when I put a child p

4条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-13 03:10

    Setting a positive padding, and a corresponding negative margin on the div element seems to fix the issue, though I know not why.

    Top Div

    Bottom Div

提交回复
热议问题