如何能正確顯示出正在加載的圖片
我用HBuilder編寫 ?.loading.pic 這種方式顯示不出來加載的gif,去掉.loading直接用.pic這樣寫,顯示的加載gif是在網(wǎng)頁的最下方,不知道怎么回事.....
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<style type="text/css">
.loading{
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
z-index: 100;
background: #fff;
}
.pic{
width: 64px;
height: 64px;
background:url(img/770.gif);
position: absolute;top 0;bottom: 0;left: 0;right: 0;margin: auto;
}
</style>
<script src="js/jquery-3.2.1.min.js"></script>
<script>
$(function(){
setInterval(function(){
$(".loading").fadeOut();
},3000)
})
</script>
</head>
<body>
<div class="loading">
<div class="pic"></div>
</div>
<img src="img/1.jpg">
</body>
</html>
2017-07-27
你的.pic 的class里面 ?的top 0 ?沒有帶冒號 瀏覽器只讀到了bottom 、left、right,top 沒有讀到這個 所以在底部顯示