Firefox、Internet Explorer 和 Safari 中的定位不同?

发布于 2024-09-06 01:27:52 字数 568 浏览 1 评论 0原文

我相信这个问题已经被问过很多次了,而且以前每次出现这个问题时我都设法克服了这个问题。刚才,我觉得它被困住了,无法找到一个合适的解决方案让它在所有浏览器中工作:它只在 Firefox 中正常工作,而在 IE 和 Safari 中,它的元素在某种程度上彼此分离。您可以在此处查看结果: http://img813.imageshack.us/img813/8393/firefox.png http://img812.imageshack.us/img812/8041/10990669.png

这是我使用的代码: http://pastebin.com/n6KEjazp

非常感谢您!

I believe this question has been asked a lot of times, and I have managed to overcome this problem before whenever it occurred. Just now, I feel stuck with it and can't find a proper solution to make it work in all browsers: it does work properly only in Firefox, while in IE and Safari its elements are somehow apart from each other. You can see the result here:
http://img813.imageshack.us/img813/8393/firefox.png
http://img812.imageshack.us/img812/8041/10990669.png

This is the code I use:
http://pastebin.com/n6KEjazp

Thank you very much in advance!

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

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

发布评论

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

评论(1

反差帅 2024-09-13 01:27:52

除了填充错误(无效的 CSS)之外,其他浏览器计算单元格高度的方式也不同。在 IE 中,高度会添加到填充中。

更改此:

  .top_menu {
      background-image: url(images/header.png);
      background-repeat: no-repeat;
      height: 155px;
      font-family: LilyUPC;
      padding-left: 184px;
      padding-top: 120px;
  }

为此:

  .top_menu {
      background-image: url(images/header.png);
      background-repeat: no-repeat;
      font-family: LilyUPC;
      padding: 120px 0 1em 184px;
  }

In addition to the padding misspelling (invalid CSS), those other browsers calculate the cell heights differently. In IE, the height is added to the padding.

Change this:

  .top_menu {
      background-image: url(images/header.png);
      background-repeat: no-repeat;
      height: 155px;
      font-family: LilyUPC;
      padding-left: 184px;
      padding-top: 120px;
  }

To this:

  .top_menu {
      background-image: url(images/header.png);
      background-repeat: no-repeat;
      font-family: LilyUPC;
      padding: 120px 0 1em 184px;
  }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文