js 0.0
This commit is contained in:
36
csspress/demo/baifenbi.html
Normal file
36
csspress/demo/baifenbi.html
Normal file
@@ -0,0 +1,36 @@
|
||||
<!DOCTYPE html>
|
||||
<!-- -->
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<style>
|
||||
.box{
|
||||
width: 900px;
|
||||
height: 600px;
|
||||
background:orange;
|
||||
}
|
||||
.item1{
|
||||
width: 40%;
|
||||
height:80%;
|
||||
background: paleturquoise;
|
||||
float: left;
|
||||
}
|
||||
.item2{
|
||||
width:40%;
|
||||
height: 80%;
|
||||
background: blue;
|
||||
float: right;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="box">
|
||||
<div class="item1"></div>
|
||||
<div class="item2"></div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
76
csspress/demo/rem.html
Normal file
76
csspress/demo/rem.html
Normal file
@@ -0,0 +1,76 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<script>
|
||||
//designWidth:设计稿的实际宽度值,需要根据实际设置
|
||||
//maxWidth:制作稿的最大宽度值,需要根据实际设置
|
||||
//这段js的最后面有两个参数记得要设置,一个为设计稿实际宽度,一个为制作稿最大宽度,例如设计稿为750,最大宽度为750,则为(750,750)
|
||||
; (function (designWidth, maxWidth) {
|
||||
var doc = document,
|
||||
win = window,
|
||||
docEl = doc.documentElement,
|
||||
remStyle = document.createElement("style"),
|
||||
tid;
|
||||
|
||||
function refreshRem() {
|
||||
var width = docEl.getBoundingClientRect().width;
|
||||
maxWidth = maxWidth || 540;
|
||||
width > maxWidth && (width = maxWidth);
|
||||
var rem = width * 100 / designWidth;
|
||||
remStyle.innerHTML = 'html{font-size:' + rem + 'px;}';
|
||||
}
|
||||
|
||||
if (docEl.firstElementChild) {
|
||||
docEl.firstElementChild.appendChild(remStyle);
|
||||
} else {
|
||||
var wrap = doc.createElement("div");
|
||||
wrap.appendChild(remStyle);
|
||||
doc.write(wrap.innerHTML);
|
||||
wrap = null;
|
||||
}
|
||||
//要等 wiewport 设置好后才能执行 refreshRem,不然 refreshRem 会执行2次;
|
||||
refreshRem();
|
||||
|
||||
win.addEventListener("resize", function () {
|
||||
clearTimeout(tid); //防止执行两次
|
||||
tid = setTimeout(refreshRem, 300);
|
||||
}, false);
|
||||
|
||||
win.addEventListener("pageshow", function (e) {
|
||||
if (e.persisted) { // 浏览器后退的时候重新计算
|
||||
clearTimeout(tid);
|
||||
tid = setTimeout(refreshRem, 300);
|
||||
}
|
||||
}, false);
|
||||
|
||||
if (doc.readyState === "complete") {
|
||||
doc.body.style.fontSize = "16px";
|
||||
} else {
|
||||
doc.addEventListener("DOMContentLoaded", function (e) {
|
||||
doc.body.style.fontSize = "16px";
|
||||
}, false);
|
||||
}
|
||||
})(750, 750);
|
||||
</script>
|
||||
<style>
|
||||
*{
|
||||
padding:0;
|
||||
margin: 0;
|
||||
}
|
||||
.nav{
|
||||
width:2.7rem;
|
||||
height: 2.5rem;
|
||||
background: skyblue;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="nav"></div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
255
csspress/demo/rem2.html
Normal file
255
csspress/demo/rem2.html
Normal file
@@ -0,0 +1,255 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<script>
|
||||
//designWidth:设计稿的实际宽度值,需要根据实际设置
|
||||
//maxWidth:制作稿的最大宽度值,需要根据实际设置
|
||||
//这段js的最后面有两个参数记得要设置,一个为设计稿实际宽度,一个为制作稿最大宽度,例如设计稿为750,最大宽度为750,则为(750,750)
|
||||
; (function (designWidth, maxWidth) {
|
||||
var doc = document,
|
||||
win = window,
|
||||
docEl = doc.documentElement,
|
||||
remStyle = document.createElement("style"),
|
||||
tid;
|
||||
|
||||
function refreshRem() {
|
||||
var width = docEl.getBoundingClientRect().width;
|
||||
maxWidth = maxWidth || 540;
|
||||
width > maxWidth && (width = maxWidth);
|
||||
var rem = width * 100 / designWidth;
|
||||
remStyle.innerHTML = 'html{font-size:' + rem + 'px;}';
|
||||
}
|
||||
|
||||
if (docEl.firstElementChild) {
|
||||
docEl.firstElementChild.appendChild(remStyle);
|
||||
} else {
|
||||
var wrap = doc.createElement("div");
|
||||
wrap.appendChild(remStyle);
|
||||
doc.write(wrap.innerHTML);
|
||||
wrap = null;
|
||||
}
|
||||
//要等 wiewport 设置好后才能执行 refreshRem,不然 refreshRem 会执行2次;
|
||||
refreshRem();
|
||||
|
||||
win.addEventListener("resize", function () {
|
||||
clearTimeout(tid); //防止执行两次
|
||||
tid = setTimeout(refreshRem, 300);
|
||||
}, false);
|
||||
|
||||
win.addEventListener("pageshow", function (e) {
|
||||
if (e.persisted) { // 浏览器后退的时候重新计算
|
||||
clearTimeout(tid);
|
||||
tid = setTimeout(refreshRem, 300);
|
||||
}
|
||||
}, false);
|
||||
|
||||
if (doc.readyState === "complete") {
|
||||
doc.body.style.fontSize = "16px";
|
||||
} else {
|
||||
doc.addEventListener("DOMContentLoaded", function (e) {
|
||||
doc.body.style.fontSize = "16px";
|
||||
}, false);
|
||||
}
|
||||
})(750, 750);
|
||||
</script>
|
||||
<style>
|
||||
*{
|
||||
padding:0;
|
||||
margin: 0;
|
||||
}
|
||||
body{
|
||||
background-color: #F0EEEF;
|
||||
}
|
||||
.nav{
|
||||
height: 1.375rem;
|
||||
background: #DE3548;
|
||||
color: white;
|
||||
font-size: 0.37rem;
|
||||
text-align: center;
|
||||
line-height: 1.675rem;
|
||||
}
|
||||
.car{
|
||||
height: 2.95rem;
|
||||
background: white;
|
||||
border-top: 1px solid white;
|
||||
/* padding-top: 0.54rem;
|
||||
padding-left: 0.55rem; */
|
||||
box-sizing: border-box;
|
||||
margin-bottom: 0.19rem;
|
||||
|
||||
}
|
||||
.carinfo{
|
||||
width: 4.28rem;
|
||||
height: 0.96rem;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
margin-top: 0.54rem;
|
||||
margin-left: 0.55rem;
|
||||
|
||||
}
|
||||
.left{
|
||||
width: 0.96rem;
|
||||
height: 0.96rem;
|
||||
background: skyblue;
|
||||
}
|
||||
.right{
|
||||
width:2.76rem;
|
||||
height: 0.95rem;
|
||||
border-left: 0.02rem solid #D9D9D9;
|
||||
padding-left: 0.32rem;
|
||||
font-size: 0.22rem;
|
||||
color: #999999;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
justify-content: center;
|
||||
|
||||
}
|
||||
.line{
|
||||
/* width:; */
|
||||
height: 0.02rem;
|
||||
background: #D9D9D9;
|
||||
margin-top:0.49rem;
|
||||
|
||||
}
|
||||
.btns{
|
||||
display: flex;
|
||||
justify-content: space-around;
|
||||
align-items: center;
|
||||
height: 0.94rem;
|
||||
}
|
||||
.btn{
|
||||
width:2.03rem;
|
||||
height:0.54rem;
|
||||
border:0.02rem solid #DF3348;
|
||||
color: #DF3348;
|
||||
line-height: 0.54rem;
|
||||
text-align: center;
|
||||
}
|
||||
.add{
|
||||
width: 7.17rem;
|
||||
height: 0.82rem;
|
||||
background: #E03547;
|
||||
color: white;
|
||||
font-size: 0.34rem;
|
||||
text-align: center;
|
||||
line-height: 0.82rem;
|
||||
font-weight: bold;
|
||||
|
||||
}
|
||||
.addw{
|
||||
width: 100%;
|
||||
background: white;
|
||||
height: 1.07rem;
|
||||
position: fixed;
|
||||
bottom: 0px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="nav">我的车库</div>
|
||||
<div class="carlist">
|
||||
<div class="car">
|
||||
<div class="carinfo">
|
||||
<div class="left"></div>
|
||||
<div class="right">
|
||||
<div>江淮安驰-小公主</div>
|
||||
<div>2019款2.9T 手自一体 </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="line"></div>
|
||||
<div class="btns">
|
||||
<div class="btn">设为默认</div>
|
||||
<div class="btn">设为默认</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="car">
|
||||
<div class="carinfo">
|
||||
<div class="left"></div>
|
||||
<div class="right">
|
||||
<div>江淮安驰-小公主</div>
|
||||
<div>2019款2.9T 手自一体 </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="line"></div>
|
||||
<div class="btns">
|
||||
<div class="btn">设为默认</div>
|
||||
<div class="btn">设为默认</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="car">
|
||||
<div class="carinfo">
|
||||
<div class="left"></div>
|
||||
<div class="right">
|
||||
<div>江淮安驰-小公主</div>
|
||||
<div>2019款2.9T 手自一体 </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="line"></div>
|
||||
<div class="btns">
|
||||
<div class="btn">设为默认</div>
|
||||
<div class="btn">设为默认</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="car">
|
||||
<div class="carinfo">
|
||||
<div class="left"></div>
|
||||
<div class="right">
|
||||
<div>江淮安驰-小公主</div>
|
||||
<div>2019款2.9T 手自一体 </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="line"></div>
|
||||
<div class="btns">
|
||||
<div class="btn">设为默认</div>
|
||||
<div class="btn">设为默认</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="car">
|
||||
<div class="carinfo">
|
||||
<div class="left"></div>
|
||||
<div class="right">
|
||||
<div>江淮安驰-小公主</div>
|
||||
<div>2019款2.9T 手自一体 </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="line"></div>
|
||||
<div class="btns">
|
||||
<div class="btn">设为默认</div>
|
||||
<div class="btn">设为默认</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="car">
|
||||
<div class="carinfo">
|
||||
<div class="left"></div>
|
||||
<div class="right">
|
||||
<div>江淮安驰-小公主</div>
|
||||
<div>2019款2.9T 手自一体 </div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="line"></div>
|
||||
<div class="btns">
|
||||
<div class="btn">设为默认</div>
|
||||
<div class="btn">设为默认</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="addw">
|
||||
<div class="add">设为默认</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
43
csspress/demo/zishiying1.html
Normal file
43
csspress/demo/zishiying1.html
Normal file
@@ -0,0 +1,43 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<style>
|
||||
@media (max-width: 960px){ /*屏幕宽度为0~960的样式*/
|
||||
body{
|
||||
background: gold;
|
||||
}
|
||||
|
||||
}
|
||||
@media (max-width: 760px){ /*屏幕宽度为0~760的样式*/
|
||||
body{
|
||||
background: pink;
|
||||
}
|
||||
|
||||
}
|
||||
@media (max-width: 640px){ /*屏幕宽度为0~640的样式*/
|
||||
body{
|
||||
background: pink;
|
||||
}
|
||||
|
||||
}
|
||||
@media (max-width: 520px){ /*屏幕宽度为0~520的样式*/
|
||||
body{
|
||||
background: blue;
|
||||
}
|
||||
|
||||
}
|
||||
@media (max-width: 480px){ /*屏幕宽度为0~480的样式*/
|
||||
body{
|
||||
background:gray
|
||||
}
|
||||
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
50
csspress/demo/zishiying2.html
Normal file
50
csspress/demo/zishiying2.html
Normal file
@@ -0,0 +1,50 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<style>
|
||||
*{
|
||||
margin:0px;
|
||||
padding: 0;
|
||||
}
|
||||
html , body{
|
||||
width:100% ;
|
||||
height: 100%;
|
||||
}
|
||||
.box{
|
||||
width: 100%;
|
||||
height: 60%;
|
||||
border: 1px solid black;
|
||||
}
|
||||
.content{
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
background: pink;
|
||||
margin: 30px;
|
||||
}
|
||||
/* @media (max-width: 780px) {
|
||||
.box{
|
||||
width: 600px;
|
||||
}
|
||||
.content{
|
||||
background: skyblue;
|
||||
}
|
||||
}
|
||||
@media (max-width: 600px) {
|
||||
.box{
|
||||
width: 500px;
|
||||
}
|
||||
.content{
|
||||
background: rgb(135, 235, 202);
|
||||
}
|
||||
} */
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="box">
|
||||
<!-- <div class="content"></div> -->
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
147
csspress/demo2/rem.html
Normal file
147
csspress/demo2/rem.html
Normal file
@@ -0,0 +1,147 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<style>
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.dingdan {
|
||||
width: 100%;
|
||||
}
|
||||
body{
|
||||
background: #EEEEEE;
|
||||
}
|
||||
.dingdanqueren {
|
||||
/* width: 1.49rem; */
|
||||
height: 1.37rem;
|
||||
font-size: 0.37rem;
|
||||
font-family: PingFang SC;
|
||||
font-weight: 800;
|
||||
color: #222222;
|
||||
line-height: 1.37rem;
|
||||
text-align: center;
|
||||
background: white;
|
||||
}
|
||||
.dingdanxinxi{
|
||||
height: 1.65rem;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
border-bottom: 1px solid gray;
|
||||
padding-bottom: 0.38rem;
|
||||
padding-left: 0.3rem;
|
||||
padding-right: 0.25rem;
|
||||
background: white;
|
||||
}
|
||||
.tubiao{
|
||||
width: 0.17rem;
|
||||
height: 0.31rem;
|
||||
background: blue;
|
||||
margin:auto 0
|
||||
}
|
||||
.dizhi{
|
||||
width: 5.3rem;
|
||||
|
||||
}
|
||||
.nameandphonen{
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
//designWidth:设计稿的实际宽度值,需要根据实际设置
|
||||
//maxWidth:制作稿的最大宽度值,需要根据实际设置
|
||||
//这段js的最后面有两个参数记得要设置,一个为设计稿实际宽度,一个为制作稿最大宽度,例如设计稿为750,最大宽度为750,则为(750,750)
|
||||
; (function (designWidth, maxWidth) {
|
||||
var doc = document,
|
||||
win = window,
|
||||
docEl = doc.documentElement,
|
||||
remStyle = document.createElement("style"),
|
||||
tid;
|
||||
|
||||
function refreshRem() {
|
||||
var width = docEl.getBoundingClientRect().width;
|
||||
maxWidth = maxWidth || 540;
|
||||
width > maxWidth && (width = maxWidth);
|
||||
var rem = width * 100 / designWidth;
|
||||
remStyle.innerHTML = 'html{font-size:' + rem + 'px;}';
|
||||
}
|
||||
|
||||
if (docEl.firstElementChild) {
|
||||
docEl.firstElementChild.appendChild(remStyle);
|
||||
} else {
|
||||
var wrap = doc.createElement("div");
|
||||
wrap.appendChild(remStyle);
|
||||
doc.write(wrap.innerHTML);
|
||||
wrap = null;
|
||||
}
|
||||
//要等 wiewport 设置好后才能执行 refreshRem,不然 refreshRem 会执行2次;
|
||||
refreshRem();
|
||||
|
||||
win.addEventListener("resize", function () {
|
||||
clearTimeout(tid); //防止执行两次
|
||||
tid = setTimeout(refreshRem, 300);
|
||||
}, false);
|
||||
|
||||
win.addEventListener("pageshow", function (e) {
|
||||
if (e.persisted) { // 浏览器后退的时候重新计算
|
||||
clearTimeout(tid);
|
||||
tid = setTimeout(refreshRem, 300);
|
||||
}
|
||||
}, false);
|
||||
|
||||
if (doc.readyState === "complete") {
|
||||
doc.body.style.fontSize = "16px";
|
||||
} else {
|
||||
doc.addEventListener("DOMContentLoaded", function (e) {
|
||||
doc.body.style.fontSize = "16px";
|
||||
}, false);
|
||||
}
|
||||
})(750, 750);
|
||||
/*
|
||||
第一个参数是设计稿的宽度,一般设计稿有640,或者是750,你可以根据实际调整
|
||||
第二个参数则是设置制作稿的最大宽度,超过750,则以750为最大限制。
|
||||
*/
|
||||
</script>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="dingdan">
|
||||
<div class="dingdanqueren">
|
||||
<p>订单确认</p>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div class="dingdanxinxi">
|
||||
<div class="dizi">
|
||||
<div class="nameandphonen">
|
||||
<div class="name">
|
||||
<img src="" alt="">
|
||||
<p>张三</p>
|
||||
</div>
|
||||
<div class="phonen">
|
||||
<img src="" alt="">
|
||||
<p>12345678910</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="zhuzhi">
|
||||
<img src="" alt="">
|
||||
<p>山东省泰安市宁阳县文庙街道XX小区</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="tubiao"></div>
|
||||
</div>
|
||||
<div>
|
||||
|
||||
</div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
<div></div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
50
csspress/demo2/zishiying2.html
Normal file
50
csspress/demo2/zishiying2.html
Normal file
@@ -0,0 +1,50 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Document</title>
|
||||
<style>
|
||||
*{
|
||||
margin:0px;
|
||||
padding: 0;
|
||||
}
|
||||
html , body{
|
||||
width:100% ;
|
||||
height: 100%;
|
||||
}
|
||||
.box{
|
||||
width: 100%;
|
||||
height: 60%;
|
||||
border: 1px solid black;
|
||||
}
|
||||
.content{
|
||||
width: 60px;
|
||||
height: 60px;
|
||||
background: pink;
|
||||
margin: 30px;
|
||||
}
|
||||
/* @media (max-width: 780px) {
|
||||
.box{
|
||||
width: 600px;
|
||||
}
|
||||
.content{
|
||||
background: skyblue;
|
||||
}
|
||||
}
|
||||
@media (max-width: 600px) {
|
||||
.box{
|
||||
width: 500px;
|
||||
}
|
||||
.content{
|
||||
background: rgb(135, 235, 202);
|
||||
}
|
||||
} */
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="box">
|
||||
<!-- <div class="content"></div> -->
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user