移动端适配文件(引入scss)
把此下代码放入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)的更多相关文章
- vue 使用lib-flexable,px2rem 进行移动端适配 但是引入的第三方UI组件 vux 的样式缩小,解决方案
最近在写移动端项目,就想用lib-flexable,px2rem来进行适配,把px转换成rem但是也用到了第三方UI组件库vux,把这个引入发现一个问题就是vux的组件都缩小了,在网上找不到答案,最后 ...
- 从flexible.js引入高德地图谈起的移动端适配
曾几何时,前端还仅仅是PC端的.随着移动时代的兴起,h5及css3的推陈出新.前端的领域慢慢的由传统的pc端转入了移动端,这也导致了前端这一职业在风口的一段时间出尽了风头. 从开始的惶恐和无从下手,慢 ...
- 【已解决】React中配置Sass引入.scss文件无效
React中配置Sass引入.scss文件无效 在react中使用sass时,引入.scss文件失效 尝试很多方法没法解决,最终找到解决方法,希望能帮助正在坑里挣扎的筒子~ 在node_modules ...
- vue2.0 在main.js引入scss文件报错
在vue2.0的main.js中引入scss文件报错 原因是在 在build文件夹下的webpack.base.conf.js的rules里面添加配置 { test: /\.scss$/, loade ...
- React中配置Sass引入.scss文件无效
React中配置Sass引入.scss文件无效 在react中使用sass时,引入.scss文件失效尝试很多方法没法解决,最终找到解决方法,希望能帮助正在坑里挣扎的筒子~ 在node_modules文 ...
- vue项目 安装和配置sass & main.js引入scss文件报错
通过npm 安装 cnpm install --save-dev sass-loader cnpm install --save-dev node-sass 在build文件夹下的webpack.ba ...
- 移动端适配方案 flexible.js
前言 移动端适配一直以来都是前端开发中不可或缺的重要组成部分,如果没有了它,那么你做出来的页面极有可能会出现各种意外(写出来的页面与设计稿之间的差别).所有我们得找到一种相对来说让人比较满意的解决方案 ...
- viewport移动端适配,读文笔记
文章地址: viewport移动端适配 笔记: 移动端适配目的: 希望在屏幕尺寸大小不同的手机上进行访问页面时,页面显示的效果能合理的展示,我们期望的是在手机屏幕较大时显示的内容比较大一些,手机屏幕小 ...
- web开发中移动端适配
这个话题有些复杂,说起来有些琐碎,因为和移动端适配相关的问题太多了. 1. 概念 1.1 设备像素 设备像素被称为物理像素,它是显示设备中一个最小的物理部件.每个像素可以根据操作系统设置自己的颜色和亮 ...
随机推荐
- Codeforces 870F - Path(数论+分类讨论+正难则反)
Codeforces 题目传送门 & 洛谷题目传送门 首先考虑 \(d(u,v)\) 是个什么东西,分情况讨论: \(u\not\perp v\),\(d(u,v)=1\) \(u\perp ...
- 【Python小试】将核酸序列翻译成氨基酸序列
三联密码表 gencode = { 'ATA':'I', 'ATC':'I', 'ATT':'I', 'ATG':'M', 'ACA':'T', 'ACC':'T', 'ACG':'T', 'ACT' ...
- 远程登录Linux系统及上传下载文件
目录 1. 远程登录Linux系统 1.1 为什么要远程登录 1.2 Xshell6安装 1.3 连接登录 1.3.1 连接前提 1.3.2 Xshell连接配置 2. 远程上传下载文件 2.1 Xf ...
- 标准非STL容器 : bitset
1. 概念 什么是"标准非STL容器"?标准非STL容器是指"可以认为它们是容器,但是他们并不满足STL容器的所有要求".前文提到的容器适配器stack.que ...
- flask分页功能:基于flask-sqlalchemy和jinja2
先看源码: @app.route('/movie', methods=['GET', 'POST']) @app.route('/home', methods=['GET', 'POST']) @ap ...
- SpringBoot整合Shiro 一:搭建环境
Java项目的安全框架一般使用 shiro 与 spring security 具体怎么选择可以参考文章:安全框架 Shiro 和 Spring Security 如何选择 我这里选择使用Shiro ...
- c#Gridview添加颜色
e.Row.Cells[1].ForeColor = System.Drawing.Color.Blue;
- MapReduce07 Join多种应用
目录 1 Join多种应用 1.1 Reduce Join 1.2 Reduce Join实例实操 需求 需求分析 Map数据处理 Reduce端合并(数据倾斜) 代码实现 JoinBean类 Joi ...
- 12. Fedora 中文乱码问题
1. Rhythmbox(音乐播放器乱码) yum install python-mutagen mid3iconv -e GBK *.mp3 2. totem电影播放机播放列表乱码解决1).修改to ...
- pymongdb入门
Pymongo入门 安装 pip install pymongo 连接 实际就是实例化一个客户端对象,然后客户端对象中指定一个库作为库对象,库对象中的集合对象就是之后常用来执行操作的对象 1 ''' ...