Skip to content

Commit f9784aa

Browse files
committed
css实现弹窗效果
1 parent 32d2e90 commit f9784aa

File tree

1 file changed

+81
-0
lines changed

1 file changed

+81
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
7+
<title>弹窗效果</title>
8+
<style>
9+
.modal {
10+
border: 1px solid #333;
11+
border-radius: 4px;
12+
padding: 10px;
13+
}
14+
.modal-header {
15+
display: flex;
16+
justify-content: space-between;
17+
align-items: center;
18+
border-bottom: 1px solid #333;
19+
}
20+
.modal-header span {
21+
position: relative;
22+
width: 20px;
23+
height: 20px;
24+
cursor: pointer;
25+
}
26+
/* 关闭按钮 */
27+
.modal-header span::after,
28+
.modal-header span::before {
29+
content: "";
30+
position: absolute;
31+
left: 0;
32+
top: 50%;
33+
display: inline-block;
34+
width: 20px;
35+
height: 1px;
36+
background-color: #333;
37+
}
38+
.modal-header span::after {
39+
transform: rotate(45deg);
40+
}
41+
.modal-header span::before {
42+
transform: rotate(-45deg);
43+
}
44+
.modal-content {
45+
min-height: 100px;
46+
}
47+
.modal-footer {
48+
display: flex;
49+
justify-content: flex-end;
50+
}
51+
.modal-footer button {
52+
width: 100px;
53+
height: 35px;
54+
margin-right: 10px;
55+
background-color: tomato;
56+
color: #FFF;
57+
border: none;
58+
}
59+
.modal-footer button.cancel {
60+
background-color: #DDD;
61+
color: #333;
62+
}
63+
</style>
64+
</head>
65+
<body>
66+
<div class="modal">
67+
<!-- 弹窗标题与关闭按钮 -->
68+
<div class="modal-header">
69+
<h3>登录</h3>
70+
<span></span>
71+
</div>
72+
<!-- 弹窗内容 -->
73+
<div class="modal-content">...</div>
74+
<!-- 底部按钮 -->
75+
<div class="modal-footer">
76+
<button>确定</button>
77+
<button class="cancel">取消</button>
78+
</div>
79+
</div>
80+
</body>
81+
</html>

0 commit comments

Comments
 (0)