手机端的默认样式

简介: 手机端的默认样式

使用scss封装一个px转rem函数,使用例子:


.box{
width:Rm(100) //相当于100px转成的rem
}


@charset "UTF-8";
 $yh:"Microsoft Yahei";
@function Rm($px, $base: 16) {
  @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: 412px) {
  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: 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: 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% */
//     }
// }


相关文章
|
8月前
|
前端开发
实现手机端的触屏滑动效果
实现手机端的触屏滑动效果
实现手机端的触屏滑动效果
|
10月前
|
存储
将PC端的apk文件通过微信文件分享到手机,后缀名有.1
将PC端的apk文件通过微信文件分享到手机,后缀名有.1
238 0
|
移动开发
H5 页面设置了字体的粗细样式,但是在华为手机里微信打开访问样式不生效?
H5 页面设置了字体的粗细样式,但是在华为手机里微信打开访问样式不生效?
183 0
H5 页面设置了字体的粗细样式,但是在华为手机里微信打开访问样式不生效?
px转换rem自适应手机样式
/ px转换rem var IntervalId = 0; window.onload = function() { IntervalId = self.
1389 0
|
SQL 数据库 Android开发
微信手机端的本地数据全文检索优化之路
本文由微信团队原创分享,转自 WeMobileDev,感谢原作者。 1、前言 基于本地数据的全文搜索(Full-Text-Search,FTS)在移动应用上扮演着重要的角色。
2347 0
|
Android开发
DFiddler:A HTTP Packets Listener一个简易版的手机端的Fiddler。
Diddler A HTTP Packets Listener一个简易版的手机端的Fiddler。 Android系统需要Root权限。 PIC_20140121_220503_617.
822 0
|
Android开发 关系型数据库 MySQL
我的Android进阶之旅------>Android实现用Android手机控制PC端的关机和重启的功能(一)PC服务器端
因为经常开着笔记本工作,累了就坐床上玩手机,但晚上要睡觉了又不想下床去关电脑,就想做个Android软件来控制PC端的关机和重启。要想实现此功能,就得让Android手机和PC之间进行通信才能,因此采用Socket编程来实现。
1513 0
|
Android开发
我的Android进阶之旅------>Android实现用Android手机控制PC端的关机和重启的功能(二)Android客户端功能展示
Android客户端的实现思路大致如下: 1、首先扫描局域网内所有PC,看是否有PC端的服务器在运行并监听30000端口。 2、如果没有扫描到有PC端的服务器在运行并监听30000端口,则重新扫描或者退出。
1144 0
|
XML Android开发 数据格式
我的Android进阶之旅------>Android实现用Android手机控制PC端的关机和重启的功能(三)Android客户端功能实现
我的Android进阶之旅------>Android实现用Android手机控制PC端的关机和重启的功能(一)PC服务器端(地址:http://blog.csdn.
1005 0
|
3月前
|
监控 安全 Android开发
【新手必读】Airtest测试Android手机常见的设置问题
【新手必读】Airtest测试Android手机常见的设置问题