CSS margin strange behavior, why?

前端 未结 3 576
天命终不由人
天命终不由人 2021-01-20 08:11

Having the HTML below


&l         


        
3条回答
  •  面向向阳花
    2021-01-20 08:51

    That behavior is called collapsing margins. The margin values are not added but the higher value is used:

    Vertical margins may collapse between certain boxes:

    • Two or more adjoining vertical margins of block boxes in the normal flow collapse. The resulting margin width is the maximum of the adjoining margin widths. […]
    • […]

提交回复
热议问题