移动端样式重置

/* 
 * Author:GuoShuai
 * Date: 2017/7/25
 * Description: 参考了 normalize.css 以及借鉴了日常开发中常用到的一些设置,
                目标是尽可能不对浏览器样式做大的修改,确保在任何环境下都尽量好用。
 */

*,*::before,*::after{
    box-sizing: border-box;/* 修改默认盒模型 */
    -webkit-text-size-adjust: 100%;/* IOS 横屏时默认字体为140%;旋转屏幕时,字体大小不变 */ 
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);/* 修正 IOS 和 Android 可点击元素的高亮颜色 */
    -webkit-tap-highlight-color: transparent;/* i.e. Nexus5/Chrome and Kindle Fire HD 7'' */
    -webkit-touch-callout: none;
}

/**
 * 尽可能使用系统原生字体,PC上很多字体手机端并没有,保留Arial用于PC端调试;
 */
html, body{
    font-family:"Helvetica Neue", Helvetica, Arial, sans-serif;
}

/* 清除内外边距 */
body, h1, h2, h3, h4, h5, h6, hr, p, blockquote,
dl, dt, dd, ul, ol, li, th, td, pre, 
fieldset, lengend, button, input, textarea{
    margin: 0;
    padding: 0;
}

h1, h2, h3, h4, h5, h6{ font-weight: normal;line-height: 1.4em;}
h1{ font-size: 2em;}
h2{ font-size: 1.4em;}
h3{ font-size: 1.2em;}
h4, h5, h6{ font-size: 1em;}

/**
 * 重置标签元素
 * 1. Remove the gray background on active links in IE 10.
 * 2. Remove gaps in links underline in iOS 8+ and Safari 8+.
 * 3. 当在iOS上触摸并按住一个元素的时候,Safari会展示一个关于这个链接的callout信息。禁用该属性。
 */
a{
    text-decoration:none;
    background-color:transparent;/* 1 */
    -webkit-text-decoration-skip: objects;/* 2 */
    -webkit-touch-callout:none;/* 3 */
    color: inherit;
}

img{
    -webkit-touch-callout:none;/* 见  */
}

/* 重置列表元素 */
ol, ul{
    list-style: none;
}

/* 重置表格元素 */
table { 
    border-collapse: collapse; 
    border-spacing: 0;
}

div{
    border : none; 
    box-shadow: none;
}

/* Add the correct display in IE 9-.*/
article, aside, footer, header, nav, section {
  display: block;
}

/* 统一等宽字体 */
code, kbd, pre, samp, tt {
    font-family: "Courier New", monospace, Courier;
} 

/**
 * 1. Remove the bottom border in Chrome 57- and Firefox 39-.
 * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
 */
abbr[title] {
  border-bottom: none; /* 1 */
  text-decoration: underline; /* 2 */
}

/* reset the correct font weight in Chrome, Edge, and Safari. */
b, strong {
    font-weight: bolder;
}

/* Add the correct background and color in IE 9-.*/
mark {
  background-color: #ff0;
  color: #000;
}

/* Add the correct font size in all browsers.*/
small {
    font-size: 80%;
}

/**
 * Prevent `sub` and `sup` elements from affecting the line height in
 * all browsers.
 */
sub, sup {
  font-size: 75%;
  line-height: 0;
  position: relative;
  vertical-align: baseline;
}
sub {
  bottom: -0.25em;
}
sup {
  top: -0.5em;
}

/**
 * Add the correct display in IE 9-.
 */
audio, video {
  display: inline-block;
}


/* Hide the overflow in IE. */
svg:not(:root) {
  overflow: hidden;
}

/* Add the correct display in IE 9-. */
canvas {
  display: inline-block;
}

/* Add the correct display in IE. */
template {
  display: none;
}

/* Add the correct display in IE 10-.*/
[hidden] {
  display: none;
}

/* Correct the padding in Firefox. */
fieldset {
  padding: 0.35em 0.75em 0.625em;
}

/**
 * 1. Add the correct display in IE 9-.
 * 2. Add the correct vertical alignment in Chrome, Firefox, and Opera.
 */
progress {
  display: inline-block; /* 1 */
  vertical-align: baseline; /* 2 */
}

/* ------------------Form------------------ */
/**
 * 1. Prevent a WebKit bug where (2) destroys native `audio` and `video`
 *    controls in Android 4.
 * 2. Correct the inability to style clickable types in iOS and Safari.
 */
button,
html [type="button"], /* 1 */
[type="reset"],
[type="submit"] {
  -webkit-appearance: button; /* 2 */
}
/* Remove the inner border and padding in Firefox. */
button::-moz-focus-inner,
[type="button"]::-moz-focus-inner,
[type="reset"]::-moz-focus-inner,
[type="submit"]::-moz-focus-inner {
  border-style: none;
  padding: 0;
}

/* Restore the focus styles unset by the previous rule. */
button:-moz-focusring,
[type="button"]:-moz-focusring,
[type="reset"]:-moz-focusring,
[type="submit"]:-moz-focusring {
  outline: 1px dotted ButtonText;
}

/**
 * 1. Add the correct box sizing in IE 10-.
 * 2. Remove the padding in IE 10-.
 */
[type="checkbox"],
[type="radio"] {
  box-sizing: border-box; /* 1 */
  padding: 0; /* 2 */
}

/* Correct the cursor style of increment and decrement buttons in Chrome. */
[type="number"]::-webkit-inner-spin-button,
[type="number"]::-webkit-outer-spin-button {
  height: auto;
}

/* 取消chrome下默认的文本框聚焦样式 */
input, textarea{
    outline:none;
}

/* 移除 chrome 自动补全时黄色背景 */
input:-webkit-autofill {
    -webkit-box-shadow: 0 0 0 30px white inset;
}

/* 修改占位文字的默认样式 */
input::-moz-placeholder, textarea::-moz-placeholder {
    color: #cccccc;
} 
input:-ms-input-placeholder, textarea:-ms-input-placeholder { 
    color: #cccccc;
} 
input::-webkit-input-placeholder, textarea::-webkit-input-placeholder {
    color: #cccccc;
}

你可能感兴趣的:(移动端样式重置)