body/container 的边框在 IE 11 中不可见

Border of body/container not visible in IE 11

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

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

.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

我在 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 中可见。

我建议你用这段代码做一个测试,看看它是否显示边框。如果问题仍然存在,请尝试 post 该页面的确切 HTML 和 CSS 代码。我们将尝试对其进行测试以检查问题。

很高兴我的评论奏效了!我不确定所以我将它作为评论发布但在这里它是作为答案所以人们可以 accept/upvote:

Its a weird fix but I have had borders disappear in IE and I fixed it by either adding display:block or display:inline-block to the element depending on what element it was. It is hard to offer better advice without more code to be able to reproduce your issue. This is a hack fix but microsoft will be discontinuing support for IE this year which means you will no longer have to support it as well. Our office is going to throw a party when IE support is officially over :D

很高兴它对你有用!