把此下代码放入scss文件 使用时候引入scss文件

@charset "UTF-8";
$yh:"Microsoft yahei";
@function rm($px, $base: 24) {
@return ($px / $base) * 1rem;
}
// @function pxToRemr($px, $base: 14.0625) {
// @return ($px / $base) * 1rem;
// }
html {
font-size: 62.5%; font-family:$yh;
}
body, textarea, input, select, option {
color: #333;
font-family: "Hiragino Sans GB", "Microsoft Yahei", tahoma, arial, sans-serif;
-webkit-font-smoothing: antialiased;
-webkit-tap-highlight-color:transparent;
}
body,h1,h2,h3,h4,h5,h6,blockquote,ol,ul,dl,dd,p,textarea,input,select,option,form {
margin:0; padding:0;
} ol,ul,textarea,input,option,th,td {
padding:0;
}
.page{
min-width: 320px;max-width: 750px;margin: 0 auto;
}
h1,h2,h3,h4,h5,h6 {
font-weight: normal;
font-size:100%;
}
a,select,input,textarea{
outline: none;
}
article, aside, details, figcaption, figure, footer, header, menu, nav, section {
display: block;
}
table {
border-collapse:collapse;border-spacing: 0;
}
ul,ol {
list-style-type:none;
}
.hide {
display: none;
}
.show {
display: block;
}
.clearfix:after {
content:'.';display:block;height:0;clear:both;visibility:hidden;
}
//.clearfix {*zoom:1;}
.clear {
clear:both;height:0;overflow:hidden;
}
/* ios默认文本框阴影 */
input[type=text],textarea{
-webkit-appearance:none;
}
/* 低版本安卓文本框层级问题 */
input:focus{
-webkit-user-modify:read-write-plaintext-only;
}
fieldset, img {
border: 0;
}
a {
text-decoration:none;
}
a,textarea,input{
outline:none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after, q:before, q:after {
content: '';
content: none;
}
textarea {
overflow:auto;resize:none;
}
// 以下是按照320下12像素字号走的,因为谷歌不识别小于12号字号
@media only screen and (min-width: 320px){
html {
font-size: 75%!important; /* 12÷16=75% */
}
}
/**
62.5% 10px;
640 150% 24px;
320除以标准比例 640 再乘以 640的基数24 再除以 HTML 根据基数16
320/640 * 24 / 16 = 75%;
375/640 * 24 / 16 = 87.89%;
414/640 * 24 / 16 = 97.03%
*/
@media only screen and (min-width: 360px){
html {
font-size: 84.3%!important; /* 13.5÷16=84.3% */
}
}
@media only screen and (min-width: 375px){
html {
font-size: 87.890625%!important; /* 14.0625÷16=87.890625% */
}
}
@media only screen and (min-width: 384px){
html {
font-size: 90%!important; /* 14.4÷16=90% */
}
}
@media only screen and (min-width: 390px){
html {
font-size: 91.4%!important; /* 14.625÷16=91.4% */
}
}
@media only screen and (min-width: 411px){
html {
font-size: 96.56%!important; /* 15.45÷16=96.56% */
}
}
@media only screen and (min-width: 414px){
html {
font-size: 97.03%!important; /* 15.525÷16=97.03% */
}
}
@media only screen and (min-width: 480px){
html {
font-size: 112.5%!important; /* 18÷16=112.5% */
}
}
@media only screen and (min-width: 540px){
html {
font-size: 126.5625%!important; /* 28.125÷16=175.78125% */
}
}
@media only screen and (min-width: 560px){
html {
font-size: 131.25%!important;/* 21÷16=131.25% */
}
}
@media only screen and (min-width: 640px){
html {
font-size: 150%!important; /* 24÷16=150% */
}
}
@media only screen and (min-width: 720px){
html {
font-size: 168.75%!important; /* 27÷16=168.75% */
}
}
@media only screen and (min-width: 750px){
html {
font-size: 175.78125%!important; /* 28.125÷16=175.78125% */
}
}
@media only screen and (min-width: 768px){
html {
font-size: 180%!important; /* 28.125÷16=175.78125% */
}
}
@media only screen and (min-width: 800px){
html {
font-size: 187.5%!important; /* 30÷16=146.43% */
}
}
@media only screen and (min-width: 960px){
html {
font-size: 225%!important; /* 36÷16=146.43% */
}
}
@media only screen and (min-width: 1024px){
html {
font-size: 240%!important; /* 36÷16=146.43% */
}
}

  本章CSDN地址:https://blog.csdn.net/lastone1212/article/details/117332284

移动端适配文件(引入scss)的更多相关文章

  1. vue 使用lib-flexable,px2rem 进行移动端适配 但是引入的第三方UI组件 vux 的样式缩小,解决方案

    最近在写移动端项目,就想用lib-flexable,px2rem来进行适配,把px转换成rem但是也用到了第三方UI组件库vux,把这个引入发现一个问题就是vux的组件都缩小了,在网上找不到答案,最后 ...

  2. 从flexible.js引入高德地图谈起的移动端适配

    曾几何时,前端还仅仅是PC端的.随着移动时代的兴起,h5及css3的推陈出新.前端的领域慢慢的由传统的pc端转入了移动端,这也导致了前端这一职业在风口的一段时间出尽了风头. 从开始的惶恐和无从下手,慢 ...

  3. 【已解决】React中配置Sass引入.scss文件无效

    React中配置Sass引入.scss文件无效 在react中使用sass时,引入.scss文件失效 尝试很多方法没法解决,最终找到解决方法,希望能帮助正在坑里挣扎的筒子~ 在node_modules ...

  4. vue2.0 在main.js引入scss文件报错

    在vue2.0的main.js中引入scss文件报错 原因是在 在build文件夹下的webpack.base.conf.js的rules里面添加配置 { test: /\.scss$/, loade ...

  5. React中配置Sass引入.scss文件无效

    React中配置Sass引入.scss文件无效 在react中使用sass时,引入.scss文件失效尝试很多方法没法解决,最终找到解决方法,希望能帮助正在坑里挣扎的筒子~ 在node_modules文 ...

  6. vue项目 安装和配置sass & main.js引入scss文件报错

    通过npm 安装 cnpm install --save-dev sass-loader cnpm install --save-dev node-sass 在build文件夹下的webpack.ba ...

  7. 移动端适配方案 flexible.js

    前言 移动端适配一直以来都是前端开发中不可或缺的重要组成部分,如果没有了它,那么你做出来的页面极有可能会出现各种意外(写出来的页面与设计稿之间的差别).所有我们得找到一种相对来说让人比较满意的解决方案 ...

  8. viewport移动端适配,读文笔记

    文章地址: viewport移动端适配 笔记: 移动端适配目的: 希望在屏幕尺寸大小不同的手机上进行访问页面时,页面显示的效果能合理的展示,我们期望的是在手机屏幕较大时显示的内容比较大一些,手机屏幕小 ...

  9. web开发中移动端适配

    这个话题有些复杂,说起来有些琐碎,因为和移动端适配相关的问题太多了. 1. 概念 1.1 设备像素 设备像素被称为物理像素,它是显示设备中一个最小的物理部件.每个像素可以根据操作系统设置自己的颜色和亮 ...

随机推荐

  1. 【GS应用】基因组选择在杂交玉米上的应用示例

    目录 GS两步走 示例 缩短周期和成本 分类 杂交类型 试验研究 选择响应 选择的强度 选择的周期 预测能力 数据分析的注意事项 GS实施 优缺点 GS的成功 展望 GS两步走 示例 缩短周期和成本 ...

  2. bcftools 提取vcf(snp/indel)文件子集

    做群体变异检测后,通常会有提取子集的操作,之前没有发现bcftools有这个功能,都是自己写脚本操作,数据量一上来,速度真的是让人无语凝噎.这里记录下提取子vcf文件的用法,软件版本:bcftools ...

  3. 【机器学习与R语言】1-机器学习简介

    目录 1.基本概念 2.选择机器学习算法 3.使用R进行机器学习 1.基本概念 机器学习:发明算法将数据转化为智能行为 数据挖掘 VS 机器学习:前者侧重寻找有价值的信息,后者侧重执行已知的任务.后者 ...

  4. os.path.join()函数

    连接两个或更多的路径名组件 import os p1 = '/date' p2 = 'mage' p3 = 'img' all = os.path.join(p1,p2,p3) print(all) ...

  5. 【ThermoRawFileParser】质谱raw格式转换mgf

    众所周知,Proteowizard MSconvert用于质谱原始数据的格式转换,但主要平台是windows,要想在Linux上运行需要打Docker或Wine,对于普通用户来说还是很困难的,想想质谱 ...

  6. centos yum安装mongodb,php扩展

    一,安装mongodb,php扩展 ? 1 [root@localhost ~]# yum install php-pecl-mongo mongodb mongodb-devel mongodb-s ...

  7. 【模板】单源最短路径(Dijkstra)/洛谷P4779

    题目链接 https://www.luogu.com.cn/problem/P4779 题目大意 给定一个 \(n\) 个点 \(m\) 条边有向图,每个点有一个非负权值,求从 \(s\) 点出发,到 ...

  8. 【模板】网络最大流(EK、Dinic、ISAP)(网络流)/洛谷P3376

    题目链接 https://www.luogu.com.cn/problem/P3376 题目大意 输入格式 第一行包含四个正整数 \(n,m,s,t\),分别表示点的个数.有向边的个数.源点序号.汇点 ...

  9. 学习java 7.1

    学习内容:数组的定义格式:int[ ] arr;  int arr[ ]; 数组的动态初始化:int[ ] arr = new int[ ];静态初始化:int[ ] arr = new int[ ] ...

  10. SpringBoot之HandlerInterceptorAdapter

    SpringBoot之HandlerInterceptorAdapter   在SpringBoot中我们可以使用HandlerInterceptorAdapter这个适配器来实现自己的拦截器.这样就 ...