variables.less
/*必须与编码保持一致*/
@charset "UTF-8";
/*适配主流设备*/
@adapterDeviceList:750px,720px,700px,640px,540px,480px,424px,414px,400px,384px,375px,360px,320px;
/*设计稿的尺寸*/
@psdWidth:640px;
/*预设基准值*/
@baseFontSize:100px;
/*设备的种类*/
@len:length(@adapterDeviceList);
mixin.less
.adapterMixin(@index) when (@index >0){
@media(min-width:extract(@adapterDeviceList,@index)){
html{
font-size: @baseFontSize * psdWidth / extract(@adapterDeviceList,@index);
}
}
.adapterMixin(@index-1);
}
adapter.less
.adapter(@length)