效果不错的,应用轻松,方便引入,喜欢的拿走吧!
<div class="container">
<div class="interior">
<a class="btn" href="#open-modal">点击我弹出</a>
</div>
</div>
<div id="open-modal" class="modal-window">
<div>
<a href="#" title="Close" class="modal-close">关闭</a>
<h1>嗨!</h1>
<div>我是弹出层内容!</div>
<div><small>本容</small></div>
</div>
</div>
.modal-window {
position: fixed;
background-color: rgba(560, 560, 560, 0.25);
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 999;
visibility: hidden;
opacity: 0;
pointer-events: none;
-webkit-transition: all 0.3s;
transition: all 0.3s;
}
.modal-window:target {
visibility: visible;
opacity: 1;
pointer-events: auto;
}
.modal-window > div {
width: 400px;
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
padding: 2em;
background: #ffffff;
}
.modal-window header {
font-weight: bold;
}
.modal-window h1 {
font-size: 150%;
margin: 0 0 15px;
}
.modal-close {
color: #aaa;
line-height: 50px;
font-size: 80%;
position: absolute;
right: 0;
text-align: center;
top: 0;
width: 70px;
text-decoration: none;
}
.modal-close:hover {
color: black;
}
/* Demo Styles */
html,
body {
height: 100%;
}
body {
font: 600 18px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
background-image: -webkit-gradient(linear, left top, right top, color-stop(0, #7f53ac), to(#657ced));
background-image: linear-gradient(to right, #7f53ac 0, #657ced 100%);
color: black;
}
a {
color: inherit;
}
.container {
display: grid;
-webkit-box-pack: center;
justify-content: center;
-webkit-box-align: center;
align-items: center;
height: 100vh;
}
.modal-window div:not(:last-of-type) {
margin-bottom: 15px;
}
small {
color: #aaa;
}
.btn {
background-color: #fff;
padding: 1em 1.5em;
border-radius: 3px;
text-decoration: none;
}
.btn i {
padding-right: 0.3em;
}
6个赞
最后更新:2020 年 09 月 25 日 20:13:30
分类 代码 的目录
文章部分内容来源于网络,仅供各位学习
如侵害到您的权益,请联系邮件 3108308908@qq.com 反馈,我们将尽快处理。
文章地址:https://blog.yqseven.cn/index.php/archives/43/