-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path07ex.html
65 lines (58 loc) · 1.64 KB
/
07ex.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
<!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>基于ex单位的天然垂直居中对齐效果实例页面</title>
<style>
.icon-arrow {
display: inline-block;
width: 20px;
height: 1ex;
background: url(../images/arrow.png) no-repeat center;
}
</style>
</head>
<body>
<div id='divTest1'>
zhongankeji
<i class="icon-arrow"></i>
</div>
<br>
<div id='divTest2'>
众安科技
<i class="icon-arrow"></i>
</div>
<br> 修改字体和大小
<select id="selFontFamily">
<option value="simsun">宋体</option>
<option value="microsoft yahei">微软雅黑</option>
<option value="Arial">Arial</option>
<option value="Tamoha">Tamoha</option>
<option value="Consolas">Consolas</option>
</select>
<select id="selFontSize">
<option value="14px">14px</option>
<option value="18px">18px</option>
<option value="24px">24px</option>
<option value="30px">30px</option>
</select>
</body>
<script>
var ff = document.getElementById('selFontFamily'),
fs = document.getElementById('selFontSize');
var div1 = document.getElementById('divTest1'),
div2 = document.getElementById('divTest2');
if (ff && fs && div1 && div2) {
ff.onchange = function () {
div1.style.fontFamily = this.value.replace('/', ',');
div2.style.fontFamily = this.value.replace('/', ',');
};
fs.onchange = function () {
div1.style.fontSize = this.value;
div2.style.fontSize = this.value;
};
}
</script>
</html>