Why is -webkit-margin-before (and after, start, end) not being overridden by my explicit margin and padding rule?(为什么-webkit-margin-before(以及之后、开始、结束)没有被我的显式边距和填充规则覆盖?)
问题描述
我有:
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;
}
我在 chrome 中检查元素,并应用我的规则,但也应用了用户代理样式表中的以下内容:
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)
我应该如何覆盖它们?
推荐答案
我解决了.
应用用户指定的规则,webkit 会根据它呈现边距,以某种方式覆盖"默认的 -webkit 规则.
The rule specified by the user gets applied, and webkit renders margin according to it, "overriding" the default -webkit ones in some way.
我看到的空间是来自未显示为块的 img,请参阅 this 了解更多.
The space that I was seeing was from the img not being displayed as block, see this for more about it.
这篇关于为什么-webkit-margin-before(以及之后、开始、结束)没有被我的显式边距和填充规则覆盖?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:为什么-webkit-margin-before(以及之后、开始、结束)没有被我的显式边距和填充规则覆盖?


- 失败的 Canvas 360 jquery 插件 2022-01-01
- CSS媒体查询(最大高度)不起作用,但为什么? 2022-01-01
- 400或500级别的HTTP响应 2022-01-01
- 使用RSelum从网站(报纸档案)中抓取多个网页 2022-09-06
- Quasar 2+Apollo:错误:找不到ID为默认的Apollo客户端。如果您在组件设置之外,请使用ProvideApolloClient() 2022-01-01
- Fetch API 如何获取响应体? 2022-01-01
- Css:将嵌套元素定位在父元素边界之外一点 2022-09-07
- Flexslider 箭头未正确显示 2022-01-01
- addEventListener 在 IE 11 中不起作用 2022-01-01
- 如何使用 JSON 格式的 jQuery AJAX 从 .cfm 页面输出查 2022-01-01