gpt4 book ai didi

css - IE 不呈现某些 div

转载 作者:行者123 更新时间:2023-11-28 13:14:04 24 4
gpt4 key购买 nike

另一个原因是 IE,与往常一样,它是唯一无法正确显示我的网站的浏览器。我有一个 div 网格,每个都有背景图像,因此它们会缩放以适合 div 的大小。但在 IE 中,这些 div 根本无法显示,我在代码中看不到任何可能导致此问题的问题,将不胜感激任何建议:

HTML

<div id="main-grid">

<div class="grid-block" style="background-image: url(IMAGE-URL-HERE)"></div>
<div class="grid-block" style="background-image: url(IMAGE-URL-HERE)"></div>
<div class="grid-block" style="background-image: url(IMAGE-URL-HERE)"></div>
<div class="grid-block" style="background-image: url(IMAGE-URL-HERE)"></div>

</div>

CSS

#main-grid {
width: auto;
position: relative;
margin: 0 auto;
margin-top: 50px;
text-align: center;
}

.grid-block {
display: table;
vertical-align: middle;
width: 315px;
height: 220px;
margin-left: 3px;
margin-right: 3px;
margin-bottom: 9px;
background: no-repeat 50% 50%;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}

我遗漏的东西可能是显而易见的,但我似乎无法弄清楚为什么这些 div 无法在 IE 中显示。

最佳答案

DIV 不会在标准 HTML 中呈现。那可能是你的问题。我用你的案例测试了它,但 DIV 标签中的一些内容一切正常。

我的样本:

<!doctype html>
<html>
<head>
<style>
#main-grid {
width: auto;
position: relative;
margin: 0 auto;
margin-top: 50px;
text-align: center;
}

.grid-block {
display: table;
vertical-align: middle;
width: 315px;
height: 220px;
margin-left: 3px;
margin-right: 3px;
margin-bottom: 9px;
background: no-repeat 50% 50%;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
</style>
</head>
<body>
<div id="main-grid">

<div class="grid-block" style="background-image: url(http://www.heise.de/icons/ho/heise_online_logo_top.gif)">a</div>
<div class="grid-block" style="background-image: url(http://www.heise.de/icons/ho/heise_online_logo_top.gif)">b</div>
<div class="grid-block" style="background-image: url(http://www.heise.de/icons/ho/heise_online_logo_top.gif)">c</div>
<div class="grid-block" style="background-image: url(http://www.heise.de/icons/ho/heise_online_logo_top.gif)">d</div>

</div>
<body>
</html>

div 内的任何内容,空跨度,例如会做的。

关于css - IE 不呈现某些 div,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15177437/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com