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
|
<
html
>
<
head
>
<
meta
charset
=
"utf-8"
>
<
title
>hangge.com
title
>
<
style
>
html, body, div, span, h1, h2, h3 {
margin: 0;
padding: 0;
border: 0;
}
.demo {
width: 100vw;
font-size: 5vw;
margin: 0 auto;
background-color: #50688B;
color: #FFF;
}
.demo2 {
width: 80vw;
font-size: 5vw;
margin: 0 auto;
background-color: #ff6a00;
}
.demo3 {
width: 50vw;
height: 50vh;
font-size: 1vw;
margin: 0 auto;
background-color: #ff006e;
color: #FFF;
}
style
>
head
>
<
body
>
<
div
class
=
"demo"
>
<
h1
>宽度100%, 字体5%
h1
>
div
>
<
div
class
=
"demo2"
>
<
h2
>宽度80%, 字体5%
h2
>
div
>
<
div
class
=
"demo3"
>
<
h3
>宽度50%, 高度50%, 字体1%
h3
>
div
>
body
>
html
>
|
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
|
<
html
>
<
head
>
<
meta
charset
=
"utf-8"
>
<
title
>hangge.com
title
>
<
style
>
html, body, div, span, button {
margin: 0;
padding: 0;
border: 0;
}
button {
width: 120px;
height: 30px;
color: #FFFFFF;
font-family: "微软雅黑";
font-size: 14px;
background: #28B995;
}
#mask {
width: 100vw;
height: 100vh;
position: fixed;
top: 0;
left: 0;
background: #000000;
opacity: 0.5;
display: none;
}
style
>
head
>
<
body
>
<
button
onclick
=
"document.getElementById('mask').style.display='inline'"
>点击显示遮罩
button
>
<
div
id
=
"mask"
onclick
=
"document.getElementById('mask').style.display='none'"
/>
div
>
body
>
html
>
|
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
|
<
html
>
<
head
>
<
meta
charset
=
"utf-8"
>
<
title
>hangge.com
title
>
<
script
type
=
"text/javascript"
src
=
"js/jquery.js"
>
script
>
<
style
>
html, body, div, span, button {
margin: 0;
padding: 0;
border: 0;
}
button {
width: 120px;
height: 30px;
color: #FFFFFF;
font-family: "微软雅黑";
font-size: 14px;
background: #28B995;
}
.dialog-container {
display: none;
width: 100vw;
height: 100vh;
background-color: rgba(0,0,0,.35);
text-align: center;
position: fixed;
top: 0;
left: 0;
z-index: 10;
}
.dialog-container:after {
display: inline-block;
content: '';
width: 0;
height: 100%;
vertical-align: middle;
}
.dialog-box {
display: inline-block;
border: 1px solid #ccc;
text-align: left;
vertical-align: middle;
position: relative;
}
.dialog-title {
line-height: 28px;
padding-left: 5px;
padding-right: 5px;
border-bottom: 1px solid #ccc;
background-color: #eee;
font-size: 12px;
text-align: left;
}
.dialog-close {
position: absolute;
top: 5px;
right: 5px;
font-size: 12px;
}
.dialog-body {
background-color: #fff;
}
style
>
head
>
<
body
>
<
button
onclick
=
"$('#dialogContainer').show();"
>点击显示弹出框
button
>
<
div
id
=
"dialogContainer"
class
=
"dialog-container"
>
<
div
class
=
"dialog-box"
>
<
div
class
=
"dialog-title"
>居中弹出框
div
>
<
a
onclick
=
"$('#dialogContainer').hide();"
class
=
"dialog-close"
>关闭
a
>
<
div
class
=
"dialog-body"
>
<
img
src
=
"logo.png"
class
=
"demo-image"
/>
div
>
div
>
div
>
body
>
html
>
|
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
<
html
>
<
head
>
<
meta
charset
=
"utf-8"
>
<
title
>hangge.com
title
>
<
script
type
=
"text/javascript"
src
=
"js/jquery.js"
>
script
>
<
style
>
html, body, div, span, button {
margin: 0;
padding: 0;
border: 0;
}
button {
width: 120px;
height: 30px;
color: #FFFFFF;
font-family: "微软雅黑";
font-size: 14px;
background: #28B995;
}
.dialog-container {
display: none;
width: 100vw;
height: 100vh;
background-color: rgba(0,0,0,.35);
text-align: center;
position: fixed;
top: 0;
left: 0;
z-index: 10;
}
.dialog-box {
top:10vh;
left:10vw;
width: 80vw;
height: 80vh;
text-align: left;
position: absolute;
border: 1px solid #ccc;
display: flex;
flex-direction: column;
}
.dialog-title {
line-height: 28px;
padding-left: 5px;
padding-right: 5px;
border-bottom: 1px solid #ccc;
background-color: #eee;
font-size: 12px;
text-align: left;
}
.dialog-close {
position: absolute;
top: 5px;
right: 5px;
font-size: 12px;
}
.dialog-body {
background-color: #fff;
flex:1;
overflow: auto;
}
style
>
head
>
<
body
>
<
button
onclick
=
"$('#dialogContainer').show();"
>点击显示弹出框
button
>
<
div
id
=
"dialogContainer"
class
=
"dialog-container"
>
<
div
class
=
"dialog-box"
>
<
div
class
=
"dialog-title"
>居中弹出框
div
>
<
a
onclick
=
"$('#dialogContainer').hide();"
class
=
"dialog-close"
>关闭
a
>
<
div
class
=
"dialog-body"
>
<
img
src
=
"logo.png"
class
=
"demo-image"
/>
div
>
div
>
div
>
body
>
html
>
|
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
53
54
55
56
57
58
59
60
61
62
63
64
|
<
html
>
<
head
>
<
meta
charset
=
"utf-8"
>
<
title
>hangge.com
title
>
<
script
type
=
"text/javascript"
src
=
"js/jquery.js"
>
script
>
<
style
>
html, body, div, span, button {
margin: 0;
padding: 0;
border: 0;
}
button {
width: 120px;
height: 30px;
color: #FFFFFF;
font-family: "微软雅黑";
font-size: 14px;
background: #28B995;
}
.dialog-container {
display: none;
width: 100vw;
height: 100vh;
background-color: rgba(0,0,0,.35);
text-align: center;
position: fixed;
top: 0;
left: 0;
z-index: 10;
}
.dialog-container:after {
display: inline-block;
content: '';
width: 0;
height: 100%;
vertical-align: middle;
|