-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path自适应.html
80 lines (72 loc) · 2.71 KB
/
自适应.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
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- <link href="Content/bootstrap.min.css" rel="stylesheet" />-->
<!--<link href="kendoui/styles/kendo.common.min.css" rel="stylesheet" />
<link href="kendoui/styles/kendo.bootstrap.min.css" rel="stylesheet" />-->
<script>
(function (doc, win) {
var docEl = doc.documentElement,
resizeEvt = 'orientationchange' in window ? 'orientationchange' : 'resize',
recalc = function () {
var clientWidth = docEl.clientWidth;
if (!clientWidth) return;
if (clientWidth >= 1366) {
docEl.style.fontSize = '10px';
} else {
docEl.style.fontSize = 10 * (clientWidth / 1366) + 'px';
}
};
if (!doc.addEventListener) return;
win.addEventListener(resizeEvt, recalc, false);
doc.addEventListener('DOMContentLoaded', recalc, false);
})(document, window);
</script>
<style>
* {
margin: 0;
padding: 0;
}
.top {
font-size: 0;
}
.bj {
display: inline-block;
box-sizing: border-box;
width: calc(100vw/4);
height: calc(100vh/3);
color: #ffffff;
vertical-align: top;
}
.top1 {
font-size: 1.6rem;
background-color: red;
}
.top2 {
font-size: 1.4rem;
padding: 0 15px;
background-color: green;
}
.top3 {
font-size: 1.2rem;
background-color: black;
}
.top4 {
background-color: #b6ff00;
}
</style>
</head>
<body>
<div class="top">
<div class="bj top1"> 以下信息根据您的兴趣推荐2018腾讯全球合作伙伴大会上演科技人文秀 极客文青都来了<span>top1</span></div>
<div class="bj top2">以下信息根据您的兴趣推荐2018腾讯全球合作伙伴大会上演科技人文秀 极客文青都来了<span>top2</span></div>
<div class="bj top3">以下信息根据您的兴趣推荐2018腾讯全球合作伙伴大会上演科技人文秀 极客文青都来了<span>top3</span></div>
<div class="bj top4">以下信息根据您的兴趣推荐2018腾讯全球合作伙伴大会上演科技人文秀 极客文青都来了<span>top4</span></div>
</div>
</body>
</html>