为什么-webkit-margin-before(和after,start,end)没有被我的显式margin和padding规则覆盖? [英] Why is -webkit-margin-before (and after, start, end) not being overridden by my explicit margin and padding rule?

查看:196
本文介绍了为什么-webkit-margin-before(和after,start,end)没有被我的显式margin和padding规则覆盖?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有:

  html body nav figure {/ *只是为了清除特定性疑问* / 
margin: 0;
padding:0;
bottom:0;
-moz-box-sizing:border-box;
box-sizing:border-box;
background-color:yellow;
}

我在chrome中检查元素,并应用我的规则,从用户代理样式表:

  figure {
display:block;
-webkit-margin-before:1em;
-webkit-margin-after:1em;
-webkit-margin-start:40px;
-webkit-margin-end:40px;
}

我认为这些应该被覆盖...我的规则不会被覆盖

解决方案



我解决了。



用户指定的规则被应用,webkit根据它来渲染边缘,以某种方式覆盖默认的-webkit。 p>

我看到的空间是从img不显示为块,请参阅了解更多信息。


I have:

html body nav figure {   /* just to clear specificity doubts  */
    margin: 0;
    padding: 0;
    bottom: 0;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
    background-color: yellow;
}

I inspect element in chrome, and my rules are applied, but also the following from the user agent stylesheet:

figure {
    display: block;
    -webkit-margin-before: 1em;
    -webkit-margin-after: 1em;
    -webkit-margin-start: 40px;
    -webkit-margin-end: 40px;
}

I thought these should be overridden... my rules are not overridden either (not crossed out)

How should I override them?

解决方案

I solved it.

The rule specified by the user gets applied, and webkit renders margin according to it, "overriding" the default -webkit ones in some way.

The space that I was seeing was from the img not being displayed as block, see this for more about it.

这篇关于为什么-webkit-margin-before(和after,start,end)没有被我的显式margin和padding规则覆盖?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆