码迷,mamicode.com
首页 > 其他好文 > 详细

设置弹性盒要用到的属性

时间:2018-04-13 22:31:23      阅读:159      评论:0      收藏:0      [点我收藏+]

标签:eve   header   maximum   min   load   foo   size   device   配置   

1· 【 html中自适应设置】:meta和script

<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />


【和】

<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 >= 650) {
docEl.style.fontSize = ‘100px‘;
} else {
docEl.style.fontSize = 100 * (clientWidth / 360) + ‘px‘;
}
};

if (!doc.addEventListener) return;
win.addEventListener(resizeEvt, recalc, false);
doc.addEventListener(‘DOMContentLoaded‘, recalc, false);
})(document, window);
</script>

 

 

 


2· 【 less中配置】::

@import url(reset.css); //调用样式
.full(@w, @h, @bg) {
//封装宽 高 背景
width: @w;
height: @h;
background: @bg;
}
//封装弹性盒 父级属性 排序方式 左中右!!
.box(@ver:horizontal){
display: -webkit-box;
-webkit-box-orient: @ver;
}


html,body,.content{
width: 100%;
height: 100%;
overflow: auto;
// background: red;
}

.content{
.box(vertical);

.header{

}

section{
-webkit-box-flex: 1;
background: #f3f4f5;
overflow: auto;
.box(vertical);
}

footer{
.full(100%,.7rem,white);
.box(horizontal);
border-top: 2px solid #ebecec;
}


}

设置弹性盒要用到的属性

标签:eve   header   maximum   min   load   foo   size   device   配置   

原文地址:https://www.cnblogs.com/chenhongshuang/p/8823950.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!