html与css重置代码,前端开发CSS样式的重置_Reset.CSS和Normalize.CSS

/*! normalize.css v3.0.3 | MIT License | github.com/necolas/normalize.css */

/**

* 1. Set default font family to sans-serif.

* 1. 设置默认字体样式为无衬线字体

* 2. Prevent iOS and IE text size adjust after device orientation change,

* 2. 防止IOS设备和IE下字体大小因为屏幕的转向而改变。

* 附:iOS设备旋转后可能会自动调整字体大小(e.g. 竖着的时候是14px,横着就自动调整成20px)。

* without disabling user zoom.

* 并没有禁用用户放大。

*/

html {

font-family: sans-serif; /* 1 */

-ms-text-size-adjust: 100%; /* 2 */

-webkit-text-size-adjust: 100%; /* 2 */

}

/**

* Remove default margin.

* 移除默认的margin.

*/

body {

margin: 0;

}

/* HTML5 display definitions

========================================================================== */

/**

* Correct `block` display not defined for any HTML5 element in IE 8/9.

* 纠正了HTML5元素的块状属性在IE8/9中无法识别。

* Correct `block` display not defined for `details` or `summary` in IE 10/11

* and Firefox.

*IE10/11及Firefox中details` or `summary无法块状显示

* Correct `block` display not defined for `main` in IE 11.

*在IE11中main不是块状级别。

*/

article,

aside,

details,

figcaption,

figure,

footer,

header,

main,

menu,

nav,

section,

summary {

display: block;

}

/**

* 1. Correct `inline-block` display not defined in IE 8/9.

* 1.补充了HTML5新元素inline-block在IE8/9下的正确显示。

* 2. Normalize vertical alignment of `progress` in Chrome, Firefox, and Opera.

* 2.补充了部分HTML5新元素在浏览器下的垂直对齐方式为基线对齐(vertical-align: baseline)

*/

audio,

canvas,

progress,

video {

display: inline-block; /* 1 */

vertical-align: baseline; /* 2 */

}

/**

* Prevent displaying `audio` without controls in Mobile Safari 4/5/6/7.

*如果audio标签没有控制栏,则应该隐藏

*/

audio:not([controls]) {

display: none;

height: 0;

}

/**

* Address `[hidden]` styling not present in IE 8/9/10.

* Hide the `template` element in IE 8/9/10/11, Safari, and Firefox < 22.

* 新的template标签用于HTML模板,兼容旧浏览器,隐藏模板。

*/

[hidden],

template {

display: none;

}

/* Links

========================================================================== */

/**

* Remove the gray background color from active links in IE 10.

* 移除在IE10下点击超链接出现的背景。

*/

a {

background-color: transparent;

}

/**

* Improve readability of focused elements when they are also in an

* active/hover state.

*/

a:active,

a:hover {

outline: 0;

}

/* Text-level semantics

/**

*

*语义化文本标签

*/

/*

========================================================================== */

/**

* Address inconsistent styling of `abbr[title]`.

* 1. Correct styling in Firefox 39 and Opera 12.

* 2. Correct missing styling in Chrome, Edge, IE, Opera, and Safari.

*/

abbr[title] {

border-bottom: none; /* 1 */

text-decoration: underline; /* 2 */

text-decoration: underline dotted; /* 2 */

}

/**

* Address inconsistent styling of b and strong.

* 1. Correct duplicate application of `bolder` in Safari 6.0.2.

* 2. Correct style set to `bold` in Edge 12+, Safari 6.2+, and Chrome 18+.

*/

/**

*统一了b,strong样式格式:

*1.abbr元素在firefox外其他的浏览器下没有下划线的问题

*2.统一了Safari and Chrome 给b 和strong设置的属性是bolder

*/

b,

strong {

font-weight: inherit; /* 1 */

}

b,

strong {

font-weight: bolder; /* 2 */

}

/**

* Address styling not present in Safari and Chrome.

*/

/**

*dfn用于对特殊术语和专业短语的定义,在safari和chrome中不是斜体

*

*/

dfn {

font-style: italic;

}

/**

* Address variable `h1` font-size and margin within `section` and `article`

* contexts in Firefox 4+, Safari, and Chrome.

*/

/**

*在section和article中h1标签的字体大小、margin样式不统一

*

*/

h1 {

font-size: 2em;

margin: 0.67em 0;

}

/**

* Address styling not present in IE 8/9.

*/

/**

*mark标签用来突出显示标记的文本,背后有一个高亮的背景色,低版本中并不识别。

*

*/

mark {

background-color: #ff0;

color: #000;

}

/**

* Address inconsistent and variable font size in all browsers.

*/

/**

*统一了small标签在所有浏览器中的样式

*

*/

small {

font-size: 80%;

}

/**

* Prevent `sub` and `sup` affecting `line-height` in all browsers.

*/

/**

*sub和sup表示上标和下表,统一两者的样式。

*

*/

sub,

sup {

font-size: 75%;

line-height: 0;

position: relative;

vertical-align: baseline;

}

sup {

top: -0.5em;

}

sub {

bottom: -0.25em;

}

/* Embedded content

========================================================================== */

/**

* Remove border when inside `a` element in IE 8/9/10.

*/

/**

* 移除了在IE 8/9/10下a标签img的边框(旧版本的IE浏览器下有蓝色边框)

*/

img {

border: 0;

}

/**

* Correct overflow not hidden in IE 9/10/11.

*/

/**

* 图片多余部分在IE 9/10/11下不隐藏的问题

*/

svg:not(:root) {

overflow: hidden;

}

/* Grouping content群组元素

========================================================================== */

/**

* 修复margin不起作用问题

*/

figure {

margin: 1em 40px;

}

/**

* Address inconsistent styling of `hr`.

* 1. Correct `box-sizing` set to `border-box` in Firefox.

* 2. Correct `overflow` set to `hidden` in IE 8/9/10/11 and Edge 12.

*/

/**

* 统一了hr样式.

* 1. 在Firefox下设置了box-sizing`为border-box

* 2. 修正在IE 8/9/10/11 and Edge 12下overflow值为visible

*/

hr {

box-sizing: content-box; /* 1 */

height: 0; /* 1 */

overflow: visible; /* 2 */

}

/**

* Contain overflow in all browsers.

*/

/**

* 原先标签多出的直接溢出,这里标签溢出增加滚动条.

*/

pre {

overflow: auto;

}

/**

* 1. Correct inheritance and scaling of font-size for preformatted text.

* 2. Address odd `em`-unit font size rendering in all browsers.

*/

/**

* 统一了在各个浏览器中字体样式

*

*/

code,

kbd,

pre,

samp {

font-family: monospace, monospace; /* 1 */

font-size: 1em; /* 2 */

}

/* Forms表单

========================================================================== */

/**

* Known limitation: by default, Chrome and Safari on OS X allow very limited

* styling of `select`, unless a `border` property is set.

*/

/**

* 1. Correct font properties not being inherited.

* 2. Address margins set differently in Firefox 4+, Safari, and Chrome.

*/

/**

* 纠正了表单标签字体不继承的问题。

* 在各个浏览器中外边距不统一

*/

button,

input,

optgroup,

select,

textarea {

font: inherit; /* 1 */

margin: 0; /* 2 */

}

/**

* Address `overflow` set to `hidden` in IE 8/9/10/11.

*/

/**

* 将button便签在IE 8/9/10/11溢出属性改为visible

*/

button {

overflow: visible;

}

/**

* Address inconsistent `text-transform` inheritance for `button` and `select`.

* All other form control elements do not inherit `text-transform` values.

* Correct `button` style inheritance in Firefox, IE 8/9/10/11, and Opera.

* Correct `select` style inheritance in Firefox.

*/

/**

* 纠正了button、select标签text-transform属性继承的问题。

*

*/

button,

select {

text-transform: none;

}

/**

* 1. Avoid the WebKit bug in Android 4.0.* where (2) destroys native `audio`

* and `video` controls.

* 2. Correct inability to style clickable `input` types in iOS.

* 3. Improve usability and consistency of cursor style between image-type

* `input` and others.

*/

/**

* 1. 避免Android 4.0.*中的WebKit bug破坏原生的audio和video控制器.

* 2. 无法设置可点击的input标签问题

* 3. 统一其他类型的input光标样式

*

*/

button,

html input[type=”button”], /* 1 */

input[type=”reset”],

input[type=”submit”] {

-webkit-appearance: button; /* 2 */

cursor: pointer; /* 3 */

}

/**

* 统一按钮禁用时的鼠标光标样式

*/

button[disabled],

html input[disabled] {

cursor: default;

}

/**

* 移除Firefox 4+下的边框和内边距.

*/

button::-moz-focus-inner,

input::-moz-focus-inner {

border: 0;

padding: 0;

}

/**

* Restore focus style in Firefox 4+ (unset by a rule above)

*/

button:-moz-focusring,

input:-moz-focusring {

outline: 1px dotted ButtonText;

}

/**

* 修复了Firefox 4+中设置`line-height`为normal!important样式。

*

*/

input {

line-height: normal;

}

/**

* It’s recommended that you don’t attempt to style these elements.

* Firefox’s implementation doesn’t respect box-sizing, padding, or width.

*

* 1. Address box sizing set to `content-box` in IE 8/9/10.

* 2. Remove excess padding in IE 8/9/10.

*/

/**

* 1. 修正checkbox、radio在IE 8/9/10下box sizing设置为content-box的问题

* 2. 移除checkbox、radio在IE 8/9/10中多余的内边距

*/

input[type=”checkbox”],

input[type=”radio”] {

box-sizing: border-box; /* 1 */

padding: 0; /* 2 */

}

/**

* Fix the cursor style for Chrome’s increment/decrement buttons. For certain

* `font-size` values of the `input`, it causes the cursor style of the

* decrement button to change from `default` to `text`.

*/

/*修正input[type=”number”]光标改变效果*/

input[type=”number”]::-webkit-inner-spin-button,

input[type=”number”]::-webkit-outer-spin-button {

height: auto;

}

/**

* Address `appearance` set to `searchfield` in Safari and Chrome.

*/

/*修正在chrome下input[type=”search”]appearance值设置为searchfield*/

input[type=”search”] {

-webkit-appearance: textfield;

}

/**

* Remove inner padding and search cancel button in Safari and Chrome on OS X.

* Safari (but not Chrome) clips the cancel button when the search input has

* padding (and `textfield` appearance).

*/

/**

* 统一输入框的样式,移除了默认的一些样式。

*/

input[type=”search”]::-webkit-search-cancel-button,

input[type=”search”]::-webkit-search-decoration {

-webkit-appearance: none;

}

/**

* 统一了fieldset的border、外边距和内边距

*/

fieldset {

border: 1px solid #c0c0c0;

margin: 0 2px;

padding: 0.35em 0.625em 0.75em;

}

/**

* 1. Correct `color` not being inherited in IE 8/9/10/11.

* 2. Remove padding so people aren’t caught out if they zero out fieldsets.

*/

/**

* 1. 在 IE 8/9/10/11下颜色不继承问题

* 2. 重置了内边距

*/

legend {

border: 0; /* 1 */

padding: 0; /* 2 */

}

/**

* Remove default vertical scrollbar in IE 8/9/10/11.

*/

/**

* 移除了textarea在IE 8/9/10/11下的滚动条

*/

textarea {

overflow: auto;

}

/**

* Restore font weight (unset by a rule above).

* NOTE: the default cannot safely be changed in Chrome and Safari on OS X.

*/

/**

* 统一了optgroup标签的font-weight属性为bold

*

*/

optgroup {

font-weight: bold;

}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值