實現效果: html
代碼:bash
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<style>
.x-tip-wrapper {
position: relative;
top: 100px;
width: 500px;
height: 300px;
margin: 0 auto;
color: #333;
background-color: #dddddd;
}
.x-tip-top {
width: 100%;
height: 40px;
background-color: rgb(67, 138, 254);
}
.x-tip-top-title {
position: absolute;
left: 50%;
top: 7px;
transform: translateX(-50%);
display: inline-block;
font-size: 20px;
font-weight: 600;
color: #fff;
}
.x-tip-top-back {
position: absolute;
top: 0px;
right: 0px;
width: 40px;
height: 40px;
font-size: 28px;
color: #fff;
text-align: center;
line-height: 40px;
cursor: pointer;
}
.x-tip-middle {
display: flex;
flex-direction: column;
justify-content: space-around;
width: 100%;
height: 260px;
text-align: center;
}
.x-tip-middle-tanhao {
position: relative;
width: 100%;
}
.x-tip-middle-tanhao-text {
width: 30px;
height: 30px;
margin: 0 auto;
background-color: red;
font-size: 20px;
font-weight: 700;
text-align: center;
line-height: 30px;
color: #fff;
border-radius: 50%;
}
.x-tip-middle-sub {
position: relative;
width: 100%;
}
.x-tip-middle-sub-text {
width: 60px;
height: 30px;
margin: 0 auto;
text-align: center;
background-color: rgb(67, 138, 254);
line-height: 30px;
cursor: pointer;
color: #fff;
}
</style>
</head>
<body>
<div class="x-tip-wrapper" style="display: block;">
<div class="x-tip-top">
<div class="x-tip-top-title">提示</div>
<div class="x-tip-top-back" onclick=aa()>X</div>
</div>
<div class="x-tip-middle">
<div class="x-tip-middle-tanhao">
<div class="x-tip-middle-tanhao-text">
!
</div>
</div>
<div>
對不起,你沒法進行權限申請,
<br>
<br>
請聯繫管理員!
</div>
<div class="x-tip-middle-sub">
<div class="x-tip-middle-sub-text" onclick=aa()>
肯定
</div>
</div>
</div>
</div>
<script>
var xDom = document.getElementsByClassName('x-tip-wrapper')[0]
function aa () {
xDom.style.display = 'none';
console.log(111)
}
</script>
</body>
</html>
複製代碼