【问题标题】:Border of body/container not visible in IE 11在 IE 11 中看不到主体/容器的边框
【发布时间】:2019-05-25 15:10:56
【问题描述】:

边框在 Chrome 和 Firefox 中可见,但在 IE 11 中不可见

我用谷歌搜索过,之前我的代码是border:2px solid black;我将其更改为边框样式并在多行中添加了所有细节。那没有帮助。

.container{
    margin:10px;
    padding:5px;
    border:2px;
    border-style:solid;
    border-color:black;
    border-radius:3px;
    text-align:center;
}

This is how it looks in Firefox

This is how it looks in IE 11

【问题讨论】:

  • body有什么风格?
  • 这是一个奇怪的修复,但我的 IE 中的边框消失了,我通过添加 display:blockdisplay:inline-block 到元素来修复它,具体取决于它是什么元素。如果没有更多代码来重现您的问题,就很难提供更好的建议。这是一个 hack 修复,但微软今年将停止对 IE 的支持,这意味着您将不再需要支持它。当 IE 支持正式结束时,我们的办公室将举办派对:D
  • .bodyCore{ 边框:1px 点黑色;填充:40px;边距顶部:8px;边距底部:8px; }
  • @jeh 有帮助。有效。谢谢。我只是想在 3 个浏览器中测试大声笑。

标签: css html internet-explorer border internet-explorer-11


【解决方案1】:

我在 IE 11 中使用您的 CSS 代码进行了测试。

代码:

<!doctype html>
<head>
<style>
.container{
    margin:10px;
    padding:5px;
    border:2px;
    border-style:solid;
    border-color:black;
    border-radius:3px;
    text-align:center;
}
.bodyCore{ border:1px dotted black; padding:40px; margin-top:8px; margin-bottom:8px; }
</style>
</head>
<body>
<div class="container">
<div class="bodyCore">sample text</div>
</div>
</body>
</html>

您可以在下面的结果中看到边框在 IE 11 中可见。

我建议您使用此代码进行测试,并检查它是否显示边框。如果问题仍然存在,请尝试发布该页面的确切 HTML 和 CSS 代码。我们将尝试对其进行测试以检查问题。

【讨论】:

    【解决方案2】:

    我很高兴我的评论奏效了!我不确定,所以我将其发布为评论,但这里是作为答案,以便人们可以接受/投票:

    这是一个奇怪的修复,但我的 IE 中的边框消失了,我修复了它 通过添加 display:block 或 display:inline-block 到元素 取决于它是什么元素。很难提供更好的建议 无需更多代码即可重现您的问题。这是一个黑客 修复,但微软今年将停止对 IE 的支持 意味着您将不再需要支持它。我们的办公室是 当 IE 支持正式结束时,我会举办派对:D

    很高兴它为你解决了!

    【讨论】:

      猜你喜欢
      • 2014-03-26
      • 1970-01-01
      • 1970-01-01
      • 2016-03-31
      • 2015-09-09
      • 2015-11-17
      • 2016-01-06
      • 2018-04-05
      • 1970-01-01
      相关资源
      最近更新 更多