我如何修复我的CSS,该CSS在Edge上工作正常,但需要在IE上正常工作

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

我目前正在制作一个小型网页,上面有一堆带有链接的按钮。该网页在Edge浏览器上显示完美,但我不确定如何修复它以使其在IE上正常显示。当前,按钮和导航栏太大,彼此重叠...

.header img {
    float: left;
    width: 100px;
    height: 100px;
  }

  .header h1 {
    position: relative;
    top: 18px;
    left: 10px;
    font-size: 300%;
  }
  body {
    background-color: lightblue;
  }
  .container {
    display: grid;
  }

  .nav-bar {
    display: grid;
    grid-template-columns: 16.6% 16.6% 16.6% 16.6% 16.6% 16.6%;
    justify-content: space-around;
    color: white;
    background-color: black;
    height: 40px;
    align-items: center;
    font-size: 20px;
  }

  .nav-item {
    text-align: center;
  }

  .buttons {
    display: grid;
    grid-template-columns: 16.6% 16.6% 16.6% 16.6% 16.6% 16.6%;
    justify-content: space-around;
  }

  .button-group {
    display: flex;
    flex-direction: column;
  }

  button {
    border-radius: 12px;
    background-color: gray;
    color: white;
    border: none;
    margin: 5px;
    height: 50px;
    font-size: 20px;
    cursor: pointer;
  }
  button:hover{
    background-color: #4CAF50;
    color: white;
  }
  .generaldocs{
    margin-left: 50px;
    margin-top: 10px;
  }
  .technews{
    margin-left: 90px;
    margin-top: 10px;
  }

  .nav-item a{
    color: white;
    text-decoration: none;
  }
  .header a{
    text-decoration: none;
    color: black;
  }

感谢您的任何帮助!

html css internet-explorer edge
1个回答
1
投票

尝试此代码,IE和一些旧的浏览器需要前缀才能正确运行代码。

.header img {
    float: left;
    width: 100px;
    height: 100px;
  }

  .header h1 {
    position: relative;
    top: 18px;
    left: 10px;
    font-size: 300%;
  }
  body {
    background-color: lightblue;
  }
  .container {
    display: grid;
  }

  .nav-bar {
    display: grid;
    grid-template-columns: 16.6% 16.6% 16.6% 16.6% 16.6% 16.6%;
    -ms-flex-pack: distribute;
    justify-content: space-around;
    color: white;
    background-color: black;
    height: 40px;
    -webkit-box-align: center;
    -ms-flex-align: center;
    align-items: center;
    font-size: 20px;
  }

  .nav-item {
    text-align: center;
  }

  .buttons {
    display: grid;
    grid-template-columns: 16.6% 16.6% 16.6% 16.6% 16.6% 16.6%;
    -ms-flex-pack: distribute;
    justify-content: space-around;
  }

  .button-group {
    display: -webkit-box;
    display: -ms-flexbox;
    display: flex;
    -webkit-box-orient: vertical;
    -webkit-box-direction: normal;
    -ms-flex-direction: column;
    flex-direction: column;
  }

  button {
    border-radius: 12px;
    background-color: gray;
    color: white;
    border: none;
    margin: 5px;
    height: 50px;
    font-size: 20px;
    cursor: pointer;
  }
  button:hover{
    background-color: #4CAF50;
    color: white;
  }
  .generaldocs{
    margin-left: 50px;
    margin-top: 10px;
  }
  .technews{
    margin-left: 90px;
    margin-top: 10px;
  }

  .nav-item a{
    color: white;
    text-decoration: none;
  }
  .header a{
    text-decoration: none;
    color: black;
  }
© www.soinside.com 2019 - 2024. All rights reserved.