类似alert与confirm的自定义提示框样式

类似alert:

<!DOCTYPE html>

<html lang="en">
<head>
<meta charset="UTF-8">
<title>alert</title>
<script src="./jquery-2.1.1.min.js"></script>
<script src="./bootstrap.min.js"></script>
<link rel="stylesheet" href="./bootstrap.min.css">
<style>
.mask{
width:100%;
height:100%;
position: fixed;
top:0;
left:0;
background: #000;
opacity:0.1;
z-index:998;
}
.con{
background-color:#fff;
width:300px;
height:130px;
position:fixed;
border-radius:5px;
top:50%;
left:50%;
z-index:999;
margin-left:-150px;
margin-top:-65px;


}
.border-b{
border-bottom:1px solid #b3b3b3;
margin-top:15px;
padding-bottom:15px;
}
.confirm1{
font-size:26px;
}
</style>


</head>
<body>

<!-- 遮罩 -->
<div class="mask"></div>
<!-- 内容 -->
<div class="con text-center">
<h3 class="border-b">这是一个类似alert的弹框</h3>
<div class="confirm1">确定</div>
</div>
</body>

</html>

类似confirm:

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>confirm</title>
<script src="./jquery-2.1.1.min.js"></script>
<script src="./bootstrap.min.js"></script>
<link rel="stylesheet" href="./bootstrap.min.css">
<style>
.mask{
width:100%;
height:100%;
position: fixed;
top:0;
left:0;
background: #000;
opacity:0.1;
z-index:998;
}
.con{
background-color:#fff;
width:300px;
height:130px;
position:fixed;
border-radius:5px;
top:50%;
left:50%;
z-index:999;
margin-left:-150px;
margin-top:-65px;


}
.border-b{
border-bottom:1px solid #b6b6b6;
margin-top:15px;
padding-bottom:15px;
}
.confirm2{
font-size:26px;
}
.border-r{
border-right:1px solid #b6b6b6;
}
</style>


</head>
<body>

<!-- 遮罩 -->
<div class="mask"></div>
<!-- 内容 -->
<div class="con text-center">
<h3 class="border-b">这是一个类似confirm的弹框</h3>
<div class="confirm2">
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6 border-r">确定</div>
<div class="col-xs-6 col-sm-6 col-md-6 col-lg-6">取消</div>
</div>
</div>
</body>
</html>

注:各浏览器opacity的兼容

.opacity{   
filter:alpha(opacity=50); /* IE */  
-moz-opacity:0.5; /* 老版Mozilla */  
-khtml-opacity:0.5; /* 老版Safari */  
opacity: 0.5; /* 支持opacity的浏览器*/  
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值