负顶部边距在IE 8或9中不工作 [英] Negative top margin not working in IE 8 or 9

查看:93
本文介绍了负顶部边距在IE 8或9中不工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个div与 margin-top:-200px 。我想让div在它上面的div上移/后移。

I have a div with margin-top:-200px. I want the div to move up/behind the div above it.

在IE以外的所有浏览器中效果非常好。 margin-top:200px ,所以我知道这不是一个折叠的保证金问题。

Works great in all browsers except IE so far. margin-top:200px works, so I know it's not a collapsing margin issue.

我不知道这里?

推荐答案

IE不喜欢负边距,不能正确呈现。相对或绝对地定位元素,而改用 top:-200px

IE doesn't like negative margins and doesn't render them properly. Position your elements relatively or absolutely and use top: -200px instead.

注意:定位它们可能会显着更改布局,您可能必须重新设置样式。

Note: positioning them may change the layout significantly and you may have to rework your styles.

这篇关于负顶部边距在IE 8或9中不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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