顶部的负值在 IE 中不起作用

发布于 2024-12-03 15:10:42 字数 298 浏览 3 评论 0原文

以下 css 在 IE 8 中不起作用。

content: ' ';  
position: absolute;  
left: 0px;
top: -10px; //--- this is not working in IE.

该组件在 IE 中消失。而在其他浏览器中这工作正常。


包装div css:

clear: both;
margin: 0px auto;
width: 350px;
position: relative;

Following css does not work in IE 8.

content: ' ';  
position: absolute;  
left: 0px;
top: -10px; //--- this is not working in IE.

The component disappears in IE. while in other browsers this works fine.


The wrapping div css:

clear: both;
margin: 0px auto;
width: 350px;
position: relative;

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

又怨 2024-12-10 15:10:42

通过查看您的小提琴:

您正在 form 内添加 div 。尝试将 div 放在 form 标记之外。可能是你有一些 form css 导致了这个问题。


您发布的小提琴在我身边的 IE 8 上运行良好。

By looking at your fiddle:

You are adding div inside a form. Try taking div outside of form tag. May be you have some form css that is causing this.


And the fiddle you have posted works fine on IE 8 at my side.

年少掌心 2024-12-10 15:10:42

2种可能的解决方案,无需查看更多代码:

  1. 周围的div没有将其位置设置为相对值,
  2. 您是否尝试过将元素的z索引设置为更高的值?

还不能发表评论,所以将其发布为答案

2 possible solutions without seeing more of the code:

  1. the surrounding div doesn't have it's position set to a value like relative
  2. have you tried setting the z-index of the element to a higher value?

can't post a comment yet so posting it as an answer

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文