83 lines
1.6 KiB
HTML
83 lines
1.6 KiB
HTML
<!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>rem</title>
|
|
<style>
|
|
body {
|
|
margin: 0;
|
|
}
|
|
/* html {
|
|
font-size: 20px;
|
|
}
|
|
@media only screen and (min-width: 400px) {
|
|
html {
|
|
font-size: 21.33333333px !important;
|
|
}
|
|
}
|
|
@media only screen and (min-width: 414px) {
|
|
html {
|
|
font-size: 22.08px !important;
|
|
}
|
|
}
|
|
@media only screen and (min-width: 480px) {
|
|
html {
|
|
font-size: 25.6px !important;
|
|
}
|
|
}
|
|
|
|
|
|
@media only screen and (min-width: 320px) {
|
|
html {
|
|
font-size: 17.1px !important;
|
|
}
|
|
}
|
|
@media only screen and (min-width: 375px) {
|
|
html {
|
|
font-size: 20px !important;
|
|
}
|
|
}
|
|
@media only screen and (min-width: 768px) {
|
|
html {
|
|
font-size: 41px !important;
|
|
}
|
|
} */
|
|
.box {
|
|
width: 1.87rem;
|
|
height: 1.87rem;
|
|
float: left;
|
|
}
|
|
.box_1 {
|
|
background: yellow;
|
|
}
|
|
.box_2 {
|
|
background: green;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="box_1 box">
|
|
|
|
</div>
|
|
<div class="box_2 box">
|
|
|
|
</div>
|
|
|
|
<script src="https://cdn.bootcss.com/jquery/2.1.0-beta3/jquery.js"></script>
|
|
<script>
|
|
function setFont() {
|
|
let window_width = window.innerWidth;
|
|
let font_size = parseFloat(window_width / 3.75);
|
|
$('html').css('font-size', font_size);
|
|
}
|
|
|
|
$(window).on('resize', function () {
|
|
setFont();
|
|
});
|
|
setFont();
|
|
|
|
</script>
|
|
</body>
|
|
</html> |