reset.css重置浏览器样式

  1. index.html中引用:<link rel="stylesheet" href="./static/css/reset.css">
  2. 代码如下:
@charset "utf-8";
/*!
 * @名称:reset.css
 * @功能:1、重设浏览器默认样式
 *       2、设置通用原子类
 */
/* 防止用户自定义背景颜色对网页的影响,添加让用户可以自定义字体 */
html {
    background:white;
    color:black;
    overflow-y: scroll; /* 让非ie浏览器默认也显示垂直滚动条,防止因滚动条引起的闪烁 */
}

/* 内外边距通常让各个浏览器样式的表现位置不同 */
article,aside,
body,button,blockquote,
code,
div,dl,dt,dd,details,
figcaption,figure,footer,form,fieldset,
header,hgroup,hr,h1,h2,h3,h4,h5,h6,
input,
li,legend,
menu,
nav,
ol,
p,pre,
section,
th,td,textarea,
ul
{margin:0;padding:0;}


/* 设置默认字体 */
body,button, input, select, textarea {
	font-family: 'Avenir', Helvetica, Arial, sans-serif;
	font-size: 12px;
}
/* 来自yahoo,让标题都自定义,适应多个系统应用 */
h1,h2,h3,h4,h5,h6 {
    font-size:100%;
    font-weight:500;
}
h1 { font-size: 18px; /* 18px / 12px = 1.5 */ }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
h4, h5, h6 { font-size: 100%; }
input,select,textarea {
    font-size:100%;
}
address,caption,cite,code,dfn,em,th,var{font-style:normal;font-weight:500;}/* 将斜体扶正 */
code, kbd, pre, samp, tt { font-family: "Courier New", Courier, monospace; } /* 统一等宽字体 */
small { font-size: 12px; } /* 小于 12px 的中文很难阅读,让 small 正常化 */

/*默认不显示下划线,保持页面简洁*/
a,ins{ text-decoration: none; }
/* 让链接在 hover 状态下显示下划线 */
a:hover { text-decoration: underline; }
/* 去除 ie6 & ie7 焦点点状线 */
a:focus,*:focus {outline:none;}

/* 注:1.ie6 不支持 abbr; 2.这里用了属性选择符,ie6 下无效果 */
abbr[title], acronym[title] {border-bottom: 1px dotted;cursor: help;}
/* 去掉 firefox 下此元素的边框 */
abbr,acronym {border:none;font-variant:normal;}

/* 一致的 del 样式 */
del {text-decoration:line-through;}

/* img 搭车:让链接里的 img 无边框 */
fieldset, img { border: none; } 

/* 重置 hr */
hr {border: none;height: 1px;}

/* ie6 7 8(q) bug 显示为行内表现 */
iframe {display:block;}

/* for ie6 */
legend { color: #000; } 

/*<q> 标签定义短的引用。
浏览器经常在引用的内容周围添加引号。*/
q:before, q:after { content: ''; }

/* 统一上标和下标 */
sub,sup {
    font-size:75%;
    line-height:0;
    position:relative;
    vertical-align:baseline;
}
sup {
    top:-0.5em;
}
sub {
    bottom:-0.25em;
}

table {border-collapse: collapse;border-spacing: 0;}
/* ie bug:th 不继承 text-align */
th { text-align:inherit;}

/* 重置列表元素 去掉列表前的标识,li 会继承*/
ul, ol { list-style: none; }

/*超出内容显示省略号*/
.ellipsis{  max-width: 100%;  white-space: nowrap;  text-overflow:ellipsis;  overflow:hidden;  }

/* 设置浮动,减少浮动带来的 bug */
.fl,.fr {display:inline;}
.fl {float:left;}
.fr {float:right;}

/*清除浮动*/
.clearfix {  zoom: 1;  }
.clearfix:before,
.clearfix:after {  display: table;  line-height: 0;  content: "";  }
.clearfix:after {  clear: both;  overflow:hidden;  }

.clear {
    clear:both;
    display:block;
    font-size:0;
    height:0;
    line-height:0;
    overflow:hidden;
}

/* 设置显示和隐藏,通常用来与 js 配合 */
.hide {display:none;}
.show{display:block;}
发布了46 篇原创文章 · 获赞 6 · 访问量 2万+

猜你喜欢

转载自blog.csdn.net/qq_33327325/article/details/99679864