如何在Chrome和IE 11中使此布局看起来相同?

问题描述 投票:0回答:1

我做了一个小页面,发现其中有一个错误。我向您展示了可以看到该错误的代码部分。

<!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中的显示方式有所不同。我附上了屏幕截图。如何使其在这些浏览器中显示相同?到底有什么问题?为什么显示不同?

感谢您的关注。

enter image description here

html css flexbox cross-browser internet-explorer-11
1个回答
0
投票

我从一开始就在chrome以及Internet Explorer上测试了您的代码,但一切看起来都很好,并且没有问题,如下面的屏幕快照Chrome screenshot所示

iexplorer screenshot

© www.soinside.com 2019 - 2024. All rights reserved.