-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmytest.html
123 lines (113 loc) · 3.64 KB
/
mytest.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>H5 Web App测试页面</title>
<style>
html{
font-size:62.5%;
}
body{
margin:0;
padding:0;
}
h3{
margin-top:2px;
margin-bottom: 2px;
}
/*
div{
margin-top:8px;
height:30px;
border: 1px;
line-height: 30px;
}
*/
#d1{
width:100%;
background-color:coral;
}
#d2{
width: 360px;;
background-color:aqua;
}
#d3{
width:100vw;
background-color: darkgreen;
}
#d4{
width:50vw;
height:4vh;
background-color:brown;
}
#emdiv{
font-family: '微软雅黑';
font-size:20px;
}
#em2{
font-size:0.5em;
}
#em3{
font-size:0.8em;
}
#em4{
font-size:1.0em;
}
#rem1{
font-size: 2.0rem;
}
</style>
</head>
<body>
<!--
<h3>浏览器相关参数数值</h3>
<p id="content"></p>
<h3>div宽高控制</h3>
<div id="d1">宽度为100%</div>
<div id="d2">宽度为固定值360px</div>
<div id="d3">宽度为100vw</div>
<div id="d4">高度为4vh</div>
<h3>特殊表单元素类型</h3>
<form action="#" method="post">
<label for="mytel">电话号码:</label><input type="tel" name="myteltel" id="mytel"><br>
<label for="mynumber">全是数字:</label><input pattern="\d*" id="mynumber"><br>
<a href="tel:10086">打电话给:10086</a> <br>
<a href="sms:10086">发短信给:10086</a><br>
<a href="mailto:billfox@yeah.net">发邮件给:billfox@yeah.net</a><br>
<input type="file" name="myfile" id="myfile" accept="image/*"><br>
<input type="file" name="myvideo" id="myvideo" accept="video/*"><br>
<input type="file" name="mulfile" id="mulfile" multiple><br>
</form>
-->
<h3>字体大小单位</h3>
<h4>一、em是相对父单位的尺寸大小</h4>
<div id="emdiv">
<div id="em1">没有设定单位=父亲字体大小20px</div>
<div id="em2">字体大小=0.5em</div>
<div id="em3">字体大小=0.8em</div>
<div id="em4">字体大小=1.0em</div>
</div>
<h4>二、rem是相对于浏览器的单位的</h4>
<div id="remdiv">
<div id="getsize">HTML根元素的字体大小=</div>
<div id="rem1">字体大小=2.0rem</div>
</div>
<script>
window.onload = function(){
/*
var content = document.getElementById("content");
var str = "";
str += "screen.width=" + screen.width + "<br>";
str += "screen.heignt=" + screen.height + "<br>";
str += "window.innerWidth=" + window.innerWidth + "<br>";
str += "window.innerHeight=" + window.innerHeight + "<br>";
str += "window.devicePixelRatio=" + window.devicePixelRatio + "<br>";
content.innerHTML = str;
*/
document.getElementById('getsize').innerText = "HTML根元素的字体大小="+getComputedStyle(window.document.documentElement)['font-size'];
}
</script>
</body>
</html>