reset.css重置样式--小技巧
@charset "utf-8";
/* JCHao */
body,h1,h2,h3,h4,h5,h6,p,th,td,ol,ul,li,dl,dt,dd,form,fieldset,legend,input,button,textarea,select,div,pre,code,blockquote {
margin: 0;
padding: 0;
}
body {
font-family: Arial, "微软雅黑", "宋体", Helvetica, sans-serif;
font-size: 12px;
line-height:1;
-webkit-text-size-adjust: 100%!important; /*禁止IOS调整字体大小*/
}
h1,h2,h3,h4,h5,h6,b,strong,th {
font-size: 100%;
font-weight: normal;/*去掉标题自带加粗*/
}
i,em {
font-style: normal;/*斜体扶正*/
}
ul,ol {
list-style: none;/*去掉默认列表符*/
}
/*多行文本输入框*/
textarea {
outline:none;
resize: none;/* 禁止用户重置元素大小 */
overflow: auto;/*在浏览器默认状态下没有滚动条*/
font-family: inherit;
}
img {
border: none;/*去掉ie浏览器图片外面的边框*/
vertical-align: middle;/*图片对齐方式*/
}
a {
outline:none;/*去掉描边*/
text-decoration: none;/*去掉自带下划线*/
color: #333;
}
/* a:hover {
color: #ff4800;
text-decoration: underline;
} */
table {
border-collapse: collapse;/*去掉表格自带间隙*/
border-spacing: 0;
}
th,td {
text-align: left;
vertical-align: middle;
}
input,button {
border: none;/* 去除选中轮廓效果 */
outline: none;
font-family: inherit;
background-color:transparent;/*背景色透明*/
}
a,button,input,select,textarea {
-webkit-tap-highlight-color:rgba(0,0,0,0); /*去掉a、input和button点击时的蓝色外边框和灰色半透明背景*/
}
a,button,input,optgroup,select,textarea {
-webkit-appearance:none; /*去掉webkit默认的表单样式*/
/*-webkit-appearance: checkbox;复选框*/
}
/* 清除浮动影响 */
.clearfix::after{
content: "";
display: block;
clear: both;
}
.clearfix{
*zoom: 1;
}
.fl{
float:left;
}
.fr{
float:right;
}
/* http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
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;
font-size: 100%;
font: inherit;
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;
}
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;
}
/*
* reset 的目的不是让默认样式在所有浏览器下一致,而是减少默认样式有可能带来的问题。
* The purpose of reset is not to allow default styles to be consistent across all browsers, but to reduce the potential problems of default styles.
* create by jsliang
*/
/** 清除内外边距 - clearance of inner and outer margins **/
body, h1, h2, h3, h4, h5, h6, hr, p, blockquote, /* 结构元素 - structural elements */
dl, dt, dd, ul, ol, li, /* 列表元素 - list elements */
pre, /* 文本格式元素 - text formatting elements */
form, fieldset, legend, button, input, textarea, /* 表单元素 - from elements */
th, td /* 表格元素 - table elements */ {
margin: 0;
padding: 0;
}
/** 设置默认字体 - setting the default font **/
body, button, input, select, textarea {
font: 18px/1.5 '黑体', Helvetica, sans-serif;
}
h1, h2, h3, h4, h5, h6, button, input, select, textarea { font-size: 100%; }
/** 重置列表元素 - reset the list element **/
ul, ol { list-style: none; }
/** 重置文本格式元素 - reset the text format element **/
a, a:hover { text-decoration: none; }
/** 重置表单元素 - reset the form element **/
button { cursor: pointer; }
input { font-size: 18px; outline: none; }
/** 重置表格元素 - reset the table element **/
table { border-collapse: collapse; border-spacing: 0; }
/** 图片自适应 - image responsize **/
img { border: 0; display: inline-block; width: 100%; max-width: 100%; height: auto; vertical-align: middle; }
/*
* 默认box-sizing是content-box,该属性导致padding会撑大div,使用border-box可以解决该问题
* set border-box for box-sizing when you use div, it solve the problem when you add padding and don't want to make the div width bigger
*/
div, input { box-sizing: border-box; }
/** 清除浮动 - clear float **/
.jsliang-clear:after, .clear:after {
content: '\20';
display: block;
height: 0;
clear: both;
}
.jsliang-clear, .clear {
*zoom: 1;
}
/** 设置input的placeholder - set input placeholder **/
input::-webkit-input-placeholder { color: #919191; font-size: .26rem } /* Webkit browsers */
input::-moz-placeholder { color: #919191; font-size: .26rem } /* Mozilla Firefox */
input::-ms-input-placeholder { color: #919191; font-size: .26rem } /* Internet Explorer */
本文来自博客园,作者:JackieDYH,转载请注明原文链接:https://www.cnblogs.com/JackieDYH/p/17634934.html