CSS, nested divs & margins vs. padding

后端 未结 7 2066
攒了一身酷
攒了一身酷 2021-01-13 16:10

i totally understand the box model. this question is more about trying to pin down a semantic methodology regarding when to use margins and when to use padding.

her

7条回答
  •  借酒劲吻你
    2021-01-13 16:10

    Vertical padding on the division - because if I decided I wanted a different amount of vertical space in between the multiple paragraphs I'd use bottom margins, and the top/bottom padding of the enclosing division pretty much will always stay intact assuming you just have staticly positioned elements inside.

提交回复
热议问题