【问题标题】:How to make this layout look the same in both Chrome and IE 11?如何使这种布局在 Chrome 和 IE 11 中看起来相同?
【发布时间】:2020-02-22 17:12:12
【问题描述】:

我做了一个小页面,发现里面有一个错误。我将向您展示代码中可见错误的部分。

<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Flex</title>
</head>
<body>
<style>
  .top-menu {
    padding-top: 30px;
    padding-bottom: 13px;
    padding-left: 0;
    display: flex;
  }
  .top-menu__item {
    display: flex;
    align-items: center;
    padding-left: 18px;
    padding-right: 18px;
  }
  .top-menu__item:nth-last-of-type(n+2) {
    border-right: 1px solid #96be4e;
  }
  .top-menu__link {
    font-weight: bold;
    text-transform: uppercase;
    color: #000;
    font-size: 14px;
  }
</style>
<ul class="top-menu">
  <li class="top-menu__item">
    <a href="#" class="top-menu__link">Пункт 1</a>
  </li>
  <li class="top-menu__item">
    <a href="#" class="top-menu__link">Пункт 2</a>
  </li>
  <li class="top-menu__item">
    <a href="#" class="top-menu__link">Пункт 3</a>
  </li>
  <li class="top-menu__item">
    <a href="#" class="top-menu__link">Пункт-4</a>
  </li>
  <li class="top-menu__item">
    <a href="#" class="top-menu__link">Пункт-5</a>
  </li>
  <li class="top-menu__item">
    <a href="#" class="top-menu__link">Пункт-6</a>
  </li>
  <li class="top-menu__item">
    <a href="#" class="top-menu__link">Пункт 7 с каким-то текстом "какой-то текст"</a>
  </li>
  <li class="top-menu__item">
    <a href="#" class="top-menu__link">Пункт 8 тоже с текстом "какой-то текст"</a>
  </li>
  <li class="top-menu__item">
    <a href="#" class="top-menu__link">Пункт 9</a>
  </li>
</ul>
</body>
</html>

它在 Chrome 和 IE 11 中的显示方式不同。我附上屏幕截图。如何使其在这些浏览器中显示相同?到底有什么问题?为什么显示不一样?

感谢您的关注。

【问题讨论】:

  • 我也在 IE 和 Chrome 中测试了你的代码,结果在两个浏览器中是一样的。我认为该问题与您提供的上述代码无关。您可以检查是否有其他样式表应用于元素并发布可以重现问题的代码。此外,您可以使用 F12 开发工具检查 Styles like this 以查看 IE 和 Chrome 是否有任何差异。

标签: html css flexbox cross-browser internet-explorer-11


【解决方案1】:

我已经在 chrome 和 Internet Explorer 上测试了你的代码,但一切看起来都很好,没有问题,你可以在下面的屏幕截图中看到

【讨论】:

    猜你喜欢
    • 2012-05-30
    • 1970-01-01
    • 2016-01-06
    • 2018-07-03
    • 1970-01-01
    • 2022-01-02
    • 1970-01-01
    • 2012-07-22
    • 2021-04-18
    相关资源
    最近更新 更多