我在相关问题部分找不到类似的问题,因此想尽办法。
我正在设计一个页面,该页面的加载时间将明显长到可能显示加载图标的位置。目前,我已对其进行了设置,以便图标显示在屏幕中央,并在页面上透明覆盖,直到页面加载完成为止。这是我正在使用的代码
<style type="text/css">
#overLayBackground{
background-color: rgb(250, 250, 250);
opacity: 0.7; /* Safari, Opera */
-moz-opacity:0.25; /* FireFox */
filter: alpha(opacity=70); /* IE */
z-index: 200;
height: 100%;
width: 100%;
background-repeat:repeat;
position:fixed;
top: 0px;
left: 0px;
text-align:center;
line-height: 240px;
}
#overLayBackground>img {
position:absolute; bottom:0; top:0; left:0; right:0; margin:auto;
}
<div id="overLayBackground">
<img src="www.example.com/images/loading.gif" title="Image" alt="The image" />
</div>
现在,此功能可以在Firefox和Chrome中正常运行,但是IE的图标显示在左上角。有没有办法让它像其他浏览器一样工作并将其放置在屏幕中央?
提前致谢。
最佳答案
指定文档类型并修复语法错误(样式标记内的div)后,您的代码即可在IE8中运行。