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

时间:2019-10-26 19:18:30

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

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

<!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

1 个答案:

答案 0 :(得分:0)

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

iexplorer screenshot