html中padding 3em 2em,padding:2em 2em 0;和padding:2em 2em 0 0;的区别?

padding,margin,border-width之类的都是这种规则(可以按照这种方式理解,不过似乎标准上并不是这么写的)

四个值

第一个值控制上下左右,第二个值控制左右,第三个值控制下,第四个值控制左。

同时靠后的值会覆盖靠前的值。

===========================================

刚刚翻了一下 w3c(链接)

是这么说的

The 'padding' property is a shorthand property for setting 'padding-top', 'padding-right', 'padding-bottom', and 'padding-left' at the same place in the style sheet.

If there is only one component value, it applies to all sides. If there are two values, the top and bottom paddings are set to the first value and the right and left paddings are set to the second. If there are three values, the top is set to the first value, the left and right are set to the second, and the bottom is set to the third. If there are four values, they apply to the top, right, bottom, and left, respectively.

依次是 上内边距,右内边距,下内边距,左内边距

如果只有一个值,那么应用在所有(四个)方向上

如果只有两个值,则第一个值是上下内边距,第二个值是右左内边距

如果只有三个值,则第一个值是上内边距,第二个值是左右边距,第三个值是下内边距

如果是四个值,则依次为,上内边距,右内边距,下内边距,左内边距

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值