ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

移动端适配文件(引入scss)

2021-07-07 12:04:32  阅读:178  来源: 互联网

标签:scss 16 适配 min width only 引入 font size


把此下代码放入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,16,适配,min,width,only,引入,font,size
来源: https://www.cnblogs.com/xfswy/p/14980904.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有