【问题标题】:How do I fix my CSS which works fine on Edge but doesn't on IE如何修复在 Edge 上运行良好但在 IE 上不行的 CSS
【发布时间】:2020-03-27 04:48:53
【问题描述】:

我目前正在开发一个小网页,上面有一堆带有链接的按钮。该网页在 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;
  }

【问题讨论】:

  • 我们需要看到minimal reproducible example 才能提供帮助——我们这里缺少 HTML。
  • 通过勾选正确答案的检查,您可以关闭可以帮助未来寻求者的主题
  • 只有 CSS 代码无法帮助我们检查和重现 IE 和其他浏览器的问题。我们还需要相关的 HTML 代码。这样我们就可以运行它并在不同的浏览器中检查结果可以帮助我们更好地理解问题。我建议您提供适当的示例代码。我们将再次尝试对其进行测试并尝试为您提供进一步的建议。感谢您的理解。

标签: html css internet-explorer microsoft-edge


【解决方案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;
  }

【讨论】:

    猜你喜欢
    • 2014-11-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多