Margin and padding using em

后端 未结 2 984
难免孤独
难免孤独 2021-02-18 23:21

When 1em is applied to an element, it takes the default value of the browser (usually, 16px) or the font-size value of its parent, right?. But I noticed that if I use something

2条回答
  •  隐瞒了意图╮
    2021-02-19 00:13

    1em is equal to the font-size of the element in question. So when using it with margins, it will be equivalent to the font-size of the element you're applying the margin too.

提交回复
热议问题