HTML CSS 遮罩效果!

本文介绍了一个使用HTML和CSS实现的遮罩层弹窗效果案例,展示了如何通过简单的网页代码创建一个具备基本交互功能的弹窗,并对其样式进行了设置。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

注:偷学别人的,由于暂时没时间修改,故先存着

 

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>无标题页</title>
    <style type="text/css">
    #cover
    {
        position:absolute;

        right:0px;
        bottom:0px;
        width:100%;
        height:100%;
        background-color:#D6E6FF;
        filter:alpha(opacity=55);
        -moz-opacity: 0.55;
        opacity: 0.55;       
        display:none;
        z-index:5;
    }
    #tb_window
    {
        width:450px;
        height:220px;
        border:2px #6699CC solid;
        z-index:2;
        background:#FFFFFF;
        margin:200px auto;
    }
    #Button1
    {
        margin:300px 47%;
    }
    </style>
   
    <script type="text/javascript">
    function show(message)
    {
        document.getElementById("messageId").innerHTML=message;
        document.getElementById("Button1").style.display="none";
        document.getElementById("cover").style.display="block";
    }
    function hidden()
    {
        document.getElementById("cover").style.display="none";
        document.getElementById("Button1").style.display="block";
    }
    </script>

</head>
<body style="margin:0 0 0 0; padding:0 0 0 0;">
    <form id="form1" runat="server">
   
         <div id="cover" style="left: 0px; top: 0px;">
            <div id="tb_window" style="margin-left:30%;">
                <!--title-->
                <div style="background:#6699CC; text-align:right; height:28px; padding:5px;">
                    <label id="title" style="float:left; font-size:15px; color:blue;">value</label>
                    <img onclick="javascript:hidden();" src="image/close.gif" style=" border-style:none;" />
                </div>
                <!--content-->
                <div style="padding-left:6px;">
                    <p>省/直辖市</p>
                    <div id="messageId">
                        广东 北京
                    </div>
                </div>
            </div>
        </div>
       
        <div>
            <h1 style="text-align: center">
                测试透明</h1>
      
            <input id="Button1" type="button" value="弹出遮罩层" onclick="show('广东 江苏');" />
        </div>
    </form>
</body>
</html>

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值