這篇文章主要介紹html中如何添加遮罩效果,文中介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們一定要看完!
創(chuàng)新互聯(lián)公司是專業(yè)的平邑網(wǎng)站建設(shè)公司,平邑接單;提供網(wǎng)站制作、網(wǎng)站建設(shè),網(wǎng)頁(yè)設(shè)計(jì),網(wǎng)站設(shè)計(jì),建網(wǎng)站,PHP網(wǎng)站建設(shè)等專業(yè)做網(wǎng)站服務(wù);采用PHP框架,可快速的進(jìn)行平邑網(wǎng)站開發(fā)網(wǎng)頁(yè)制作和功能擴(kuò)展;專業(yè)做搜索引擎喜愛的網(wǎng)站,專業(yè)的做網(wǎng)站團(tuán)隊(duì),希望更多企業(yè)前來合作!
這里使用div+css的方式,加載中的圖片是網(wǎng)上下載的動(dòng)圖,大家可以根據(jù)自己的需要進(jìn)行修改。
實(shí)現(xiàn)代碼:
<!DOCTYPE html> <html> <head> <title>DIV CSS遮罩層</title> <script language="javascript" type="text/javascript"> function showdiv() { document.getElementById("bg").style.display ="block"; /* document.getElementById("show").style.display ="block";*/ } function hidediv() { document.getElementById("bg").style.display ='none'; /*document.getElementById("show").style.display ='none';*/ } </script> <style type="text/css"> #bg{ display: none; position: absolute; top: 0%; left: 0%; width: 100%; height: 100%; background-color: black; z-index:1001; -moz-opacity: 0.7; opacity:.70; filter: alpha(opacity=70);} #show{display: none; position: absolute; top: 25%; left: 22%; width: 53%; height: 49%; padding: 8px; border: 8px solid #E8E9F7; background-color: white; z-index:1002; overflow: auto;} /*遮罩圖片居中顯示*/ .zhezhao{ position: absolute; top:50%; left: 50%; transform: translate(-50%,-50%); } </style> </head> <body> <input id="btnshow" type="button" value="Show" onclick="showdiv();"/> <div id="bg"> <img class="zhezhao" src="img/timg.gif"> </div> <!-- 遮罩層 --> <div id="show">測(cè)試 <input id="btnclose" type="button" value="Close" onclick="hidediv();"/> </div> </body> </html>
效果:
以上是html中如何添加遮罩效果的所有內(nèi)容,感謝各位的閱讀!希望分享的內(nèi)容對(duì)大家有幫助,更多相關(guān)知識(shí),歡迎關(guān)注創(chuàng)新互聯(lián)行業(yè)資訊頻道!
文章題目:html中如何添加遮罩效果
網(wǎng)頁(yè)路徑:http://chinadenli.net/article26/ihogcg.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供、App開發(fā)、網(wǎng)站設(shè)計(jì)公司、小程序開發(fā)、定制開發(fā)、電子商務(wù)
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)