css-reset
移动端
/**********
* cssreset for mobile
*********/
* {
box-sizing: border-box;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
}
body,
dl,
dt,
dd,
ul,
ol,
li,
h1,
h2,
h3,
h4,
h5,
h6,
pre,
code,
form,
fieldset,
legend,
input,
textarea,
p,
blockquote,
th,
td,
hr,
button,
article,
aside,
details,
figcaption,
figure,
footer,
header,
menu,
nav,
section {
margin: 0;
padding: 0;
border: 0;
}
/* 默认不要下划线 */
a {
text-decoration: none;
}
/* 按钮文本不可选 */
button {
user-select: none;
}
img {
display: inline-block;
vertical-align: middle;
}
/* 加载不出来的图片不要显示灰色边框 */
img:not([src]),
img[src=""] {
opacity: 0;
}
ul,
ol {
list-style: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
input,
select,
button,
textarea {
font-size: 100%;
font: inherit;
}
html,
body {
height: 100%;
overflow-x: hidden;
}
.clearfix:after,
.clearfix:before {
/*清除浮动*/
content: " ";
display: table;
}
.clearfix:after {
clear: both;
}
.fl {
float: left;
}
.fr {
float: right;
}
*,
*:before,
*:after {
box-sizing: border-box;
/*所有元素以border开始计算盒子大小*/
}
.justify-between {
-webkit-box-pack: justify;
-webkit-justify-content: space-between;
-ms-flex-pack: justify;
justify-content: space-between;
}
.justify-center {
-webkit-box-pack: center;
-webkit-justify-content: center;
-ms-flex-pack: center;
justify-content: center;
}
.vertical {
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-webkit-flex-direction: column;
-ms-flex-direction: column;
flex-direction: column;
}
button {
border: none;
}
/*input*/
button,
html input[type='button'],
input[type='reset'],
input[type='submit'] {
-webkit-appearance: button;
/*渲染成button的风格*/
text-transform: none;
outline: none;
}
input::-webkit-input-placeholder,
textarea::-webkit-input-placeholder {
color: #999;
/*输入框提示语的字体样式*/
}
input::-webkit-inner-spin-button {
/*解决input的type="number"在部分手机端会出现一个小按钮*/
-webkit-appearance: none;
/*去除系统默认appearance的样式,常用于IOS下移除原生样式*/
}
input::-webkit-outer-spin-button {
/*解决input的type="number"在部分手机端会出现一个小按钮*/
-webkit-appearance: none;
}
textarea {
vertical-align: top;
}
button,
input {
line-height: normal;
}
select {
margin: 0;
outline: 0;
}
input.fixAKeyboard:focus,
textarea.fixAndroidKeyboard:focus {
-webkit-tap-highlight-color: rgba(255, 255, 255, 0);
-webkit-user-modify: read-write-plaintext-only;
}
input:-webkit-autofill {
-webkit-box-shadow: 0 0 0 1000px white inset !important;
}
button,
input[type=button],
input[type=checkbox],
input[type=reset],
input[type=submit],
label {
cursor: pointer;
user-select: none;
-ms-user-select: none;
-moz-user-select: none;
-webkit-user-select: none;
}
input[type=submit] {
-webkit-user-modify: read-plaintext-only;
-moz-user-modify: read-plaintext-only;
-ms-user-modify: read-plaintext-only;
-o-user-modify: read-plaintext-only;
user-modify: read-plaintext-only;
}
input[type='search']::-webkit-search-cancel-button,
input[type='search']::-webkit-search-decoration {
-webkit-appearance: none;
}
input[type='search'] {
-webkit-box-sizing: content-box;
-moz-box-sizing: content-box;
box-sizing: content-box;
-webkit-appearance: textfield;
}
PC端
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
vertical-align: baseline;
}
/* HTML5 display-role reset for older browsers */
article, aside, details, figcaption, figure,
footer, header, hgroup, menu, nav, section {
display: block;
}
body {
line-height: 1;
}
img {
display: inline-block;
}
ol, ul {
list-style: none;
}
blockquote, q {
quotes: none;
}
blockquote:before, blockquote:after,
q:before, q:after {
content: '';
content: none;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
.clearfix {
zoom: 1;
}
.clearfix::before,
.clearfix::after {
content: "";
display: block;
clear: both;
visibility: hidden;
}
.fl {
float: left;
}
.fr {
float: right;
}