-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathmodalBox.css
52 lines (47 loc) · 1.17 KB
/
modalBox.css
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
/*模态框*/
.modal {
display: none; /* 默认隐藏 */
position: fixed; /* 根据浏览器定位 */
z-index: 1; /* 放在顶部 */
left: 0;
top: 0;
width: 100%; /* 全宽 */
height: 100%; /* 全高 */
overflow: auto; /* 允许滚动 */
background-color: rgba(0,0,0,0.4); /* 背景色 */
}
/*模态框内容*/
.modal-content {
display: flex; /*采用flexbox布局*/
flex-direction: column; /*垂直排列*/
position: relative;
background-color: #fefefe;
margin: 15% auto; /*距顶部15% 水平居中*/
padding: 20px;
border: 1px solid #888;
width: 80%;
animation: topDown 0.4s; /*自定义动画,从模态框内容上到下出现*/
}
@keyframes topDown {
from {top: -300px; opacity: 0}
to {top: 0; opacity: 1}
}
/*模态框头部*/
.modal-header {
display: flex; /*采用flexbox布局*/
flex-direction: row; /*水平布局*/
align-items: center; /*内容垂直居中*/
justify-content: space-between;
}
/*关闭X 样式*/
.close {
color: #aaa;
float: right;
font-size: 28px;
font-weight: bold;
}
.close:hover {
color: black;
text-decoration: none;
cursor: pointer;
}