在任何其他浏览器上的safari上的负边距不同的结果 [英] Negative margin different result on safari than any other browser

查看:157
本文介绍了在任何其他浏览器上的safari上的负边距不同的结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CSS:

  dd 
{
margin:-1.2em 4em 0 1em;
}

这是唯一应用的CSS规则。负边距是推动它更多到Safari的顶部,而不是任何其他浏览器。我已经用Chrome和Firefox(所有在Mac OS X上)测试过。



如何让它在所有浏览器上都一样?

$ b $我刚刚遇到这个使用百分比为负值的margin-top:他们看起来无处不在,但移动safari和移动chrome。将位置从绝对位置改为相对位置对我来说是个诡计。


CSS:

dd
{
    margin: -1.2em 4em 0 1em;
}

This is the only CSS rule applied. The negative margin is pushing it more to the top on Safari than on any other browser. I have tested it with Chrome and Firefox (all on Mac OS X).

How could I make it behave the same on all browsers?

解决方案

I just ran into this using percentage based negative values for margin-top: they looked fine everywhere but mobile safari and mobile chrome. Changing the position from absolute to relative did the trick for me.

这篇关于在任何其他浏览器上的safari上的负边距不同的结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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