編碼的世界 / 優質文選 / 生涯

【CSS實現Loading遮罩】點擊按鈕,彈出一個DIV層窗口


2021年10月08日
-   

加載中 gif 圖片:



頁面效果:



源碼


<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>點擊文字彈出一個DIV層窗口代碼</title>
<style>
.black_overlay{
display: none;
position: absolute;
top: 0%;
left: 0%;
width: 100%;
height: 100%;
background-color: black;
z-index:1001;
-moz-opacity: 0.6;
opacity:.60;
filter: alpha(opacity=66);
}
.white_content {
display: none;
position: absolute;
top: 25%;
left: 25%;
width: 55%;
height: 55%;
padding: 20px;
border: 10px solid orange;
background-color: white;
text-align: center;
z-index:1002;
overflow: auto;
}
</style>
</head>
<body>
<a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'">請點這裏</a></p>
<! 加載中遮罩 >
<div id="light" class="white_content" >
<font size="5">正在努力轉換中 ~ 此過程大約需要20秒,請耐心等待<br></font>
<img src='loading.gif' width='400px' height='300px'/>
</div>
<div id="fade" class="black_overlay"></div>
</body>
</html>

熱門文章