CSS 初始化

一、normallize.css(github的一个项目   点击进入链接

/*! normalize.css v8.0.0 | MIT License | github.com/necolas/normalize.css */

/* Document
   ========================================================================== */

/**
 * 1. Correct the line height in all browsers.
 * 2. Prevent adjustments of font size after orientation changes in iOS.
 */

html {
  line-height: 1.15; /* 1 */
  -webkit-text-size-adjust: 100%; /* 2 */
}

/* Sections
   ========================================================================== */

/**
 * Remove the margin in all browsers.
 */

body {
  margin: 0;
}

/**
 * Correct the font size and margin on `h1` elements within `section` and
 * `article` contexts in Chrome, Firefox, and Safari.
 */

h1 {
  font-size: 2em;
  margin: 0.67em 0;
}

/* Grouping content
   ========================================================================== */

/**
 * 1. Add the correct box sizing in Firefox.
 * 2. Show the overflow in Edge and IE.
 */

hr {
  box-sizing: content-box; /* 1 */
  height: 0; /* 1 */
  overflow: visible; /* 2 */
}

/**
 * 1. Correct the inheritance and scaling of font size in all browsers.
 * 2. Correct the odd `em` font sizing in all browsers.
 */

pre {
  font-family: monospace, monospace; /* 1 */
  font-size: 1em; /* 2 */
}

/* Text-level semantics
   ========================================================================== */

/**
 * Remove the gray background on active links in IE 10.
 */

a {
  background-color: transparent;
}

/**
 * 1. Remove the bottom border in Chrome 57-
 * 2. Add the correct text decoration in Chrome, Edge, IE, Opera, and Safari.
 */

abbr[title] {
  border-bottom: none; /* 1 */
  text-decoration: underline; /* 2 */
  text-decoration: underline dotted; /* 2 */
}

/**
 * Add the correct font weight in Chrome, Edge, and Safari.
 */

b,
strong {
  font-weight: bolder;
}

/**
 * 1. Correct the inheritance and scaling of font size in all browsers.
 * 2. Correct the odd `em` font sizing in all browsers.
 */

code,
kbd,
samp {
  font-family: monospace, monospace; /* 1 */
  font-size: 1em; /* 2 */
}

/**
 * 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;
}

/* Embedded content
   ========================================================================== */

/**
 * Remove the border on images inside links in IE 10.
 */

img {
  border-style: none;
}

/* Forms
   ========================================================================== */

/**
 * 1. Change the font styles in all browsers.
 * 2. Remove the margin in Firefox and Safari.
 */

button,
input,
optgroup,
select,
textarea {
  font-family: inherit; /* 1 */
  font-size: 100%; /* 1 */
  line-height: 1.15; /* 1 */
  margin: 0; /* 2 */
}

/**
 * Show the overflow in IE.
 * 1. Show the overflow in Edge.
 */

button,
input { /* 1 */
  overflow: visible;
}

/**
 * Remove the inheritance of text transform in Edge, Firefox, and IE.
 * 1. Remove the inheritance of text transform in Firefox.
 */

button,
select { /* 1 */
  text-transform: none;
}

/**
 * Correct the inability to style clickable types in iOS and Safari.
 */

button,
[type="button"],
[type="reset"],
[type="submit"] {
  -webkit-appearance: button;
}

/**
 * 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;
}

/**
 * Correct the padding in Firefox.
 */

fieldset {
  padding: 0.35em 0.75em 0.625em;
}

/**
 * 1. Correct the text wrapping in Edge and IE.
 * 2. Correct the color inheritance from `fieldset` elements in IE.
 * 3. Remove the padding so developers are not caught out when they zero out
 *    `fieldset` elements in all browsers.
 */

legend {
  box-sizing: border-box; /* 1 */
  color: inherit; /* 2 */
  display: table; /* 1 */
  max-width: 100%; /* 1 */
  padding: 0; /* 3 */
  white-space: normal; /* 1 */
}

/**
 * Add the correct vertical alignment in Chrome, Firefox, and Opera.
 */

progress {
  vertical-align: baseline;
}

/**
 * Remove the default vertical scrollbar in IE 10+.
 */

textarea {
  overflow: auto;
}

/**
 * 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;
}

/**
 * 1. Correct the odd appearance in Chrome and Safari.
 * 2. Correct the outline style in Safari.
 */

[type="search"] {
  -webkit-appearance: textfield; /* 1 */
  outline-offset: -2px; /* 2 */
}

/**
 * Remove the inner padding in Chrome and Safari on macOS.
 */

[type="search"]::-webkit-search-decoration {
  -webkit-appearance: none;
}

/**
 * 1. Correct the inability to style clickable types in iOS and Safari.
 * 2. Change font properties to `inherit` in Safari.
 */

::-webkit-file-upload-button {
  -webkit-appearance: button; /* 1 */
  font: inherit; /* 2 */
}

/* Interactive
   ========================================================================== */

/*
 * Add the correct display in Edge, IE 10+, and Firefox.
 */

details {
  display: block;
}

/*
 * Add the correct display in all browsers.
 */

summary {
  display: list-item;
}

/* Misc
   ========================================================================== */

/**
 * Add the correct display in IE 10+.
 */

template {
  display: none;
}

/**
 * Add the correct display in IE 10.
 */

[hidden] {
  display: none;
}

二、.其他的一些初始化(借鉴)

article,
        aside,
        details,
        figcaption,
        figure,
        footer,
        header,
        main,
        nav,
        section,
        summary {
            display: block
        }

        audio,
        canvas,
        video {
            display: inline-block;
            *display: inline;
            *zoom: 1
        }

        audio:not([controls]) {
            display: none;
            height: 0
        }

        [hidden] {
            display: none
        }

        html {
            font-size: 100%;
            -ms-text-size-adjust: 100%;
            -webkit-text-size-adjust: 100%
        }

        html,
        button,
        input,
        select,
        textarea {
            font-family: sans-serif
        }

        body {
            margin: 0
        }

        a:active,
        a:hover {
            outline: 0
        }

        h1 {
            font-size: 2em;
            margin: 0.67em 0
        }

        h2 {
            font-size: 1.5em;
            margin: 0.83em 0
        }

        h3 {
            font-size: 1.17em;
            margin: 1em 0
        }

        h4 {
            font-size: 1em;
            margin: 1.33em 0
        }

        h5 {
            font-size: 0.83em;
            margin: 1.67em 0
        }

        h6 {
            font-size: 0.67em;
            margin: 2.33em 0
        }

        abbr[title] {
            border-bottom: 1px dotted
        }

        b,
        strong {
            font-weight: bold
        }

        blockquote {
            margin: 1em 40px
        }

        dfn {
            font-style: italic
        }

        hr {
            -webkit-box-sizing: content-box;
            box-sizing: content-box;
            height: 0
        }

        mark {
            background: #ff0;
            color: #000
        }

        p,
        pre {
            margin: 1em 0
        }

        code,
        kbd,
        pre,
        samp {
            font-family: monospace, serif;
            _font-family: 'courier new', monospace;
            font-size: 1em
        }

        pre {
            white-space: pre;
            white-space: pre-wrap;
            word-wrap: break-word
        }

        q {
            quotes: none
        }

        q:before,
        q:after {
            content: '';
            content: none
        }

        small {
            font-size: 80%
        }

        sub,
        sup {
            font-size: 75%;
            line-height: 0;
            position: relative;
            vertical-align: baseline
        }

        sup {
            top: -0.5em
        }

        sub {
            bottom: -0.25em
        }

        dl,
        menu,
        ol,
        ul {
            margin: 1em 0
        }

        dd {
            margin: 0 0 0 40px
        }

        menu,
        ol,
        ul {
            padding: 0 0 0 40px
        }

        nav ul,
        nav ol {
            list-style: none;
            list-style-image: none
        }

        img {
            border: 0;
            -ms-interpolation-mode: bicubic
        }

        svg:not(:root) {
            overflow: hidden;
            _zoom: 1
        }

        figure {
            margin: 0
        }

        form {
            margin: 0
        }

        fieldset {
            border: 1px solid #c0c0c0;
            margin: 0 2px;
            padding: 0.35em 0.625em 0.75em
        }

        legend {
            border: 0;
            padding: 0;
            white-space: normal;
            *margin-left: -7px
        }

        button,
        input,
        select,
        textarea {
            font-size: 100%;
            margin: 0;
            vertical-align: baseline;
            *vertical-align: middle
        }

        button,
        input {
            line-height: normal
        }

        button,
        select {
            text-transform: none
        }

        button,
        html input[type="button"],
        input[type="reset"],
        input[type="submit"] {
            -webkit-appearance: button;
            cursor: pointer;
            *overflow: visible;
            border-radius: 0
        }

        button[disabled],
        html input[disabled] {
            cursor: default
        }

        input[type="checkbox"],
        input[type="radio"] {
            -webkit-box-sizing: border-box;
            box-sizing: border-box;
            padding: 0;
            *height: 13px;
            *width: 13px
        }

        input[type="search"] {
            -webkit-appearance: textfield;
            -webkit-box-sizing: content-box;
            box-sizing: content-box
        }

        input[type="search"]::-webkit-search-cancel-button,
        input[type="search"]::-webkit-search-decoration {
            -webkit-appearance: none
        }

        button::-moz-focus-inner,
        input::-moz-focus-inner {
            border: 0;
            padding: 0
        }

        textarea {
            overflow: auto;
            vertical-align: top
        }

        table {
            border-collapse: collapse;
            border-spacing: 0
        }

        body {
            font: 14px/1.5 "Helvetica Neue", Helvetica, Arial, "Microsoft Yahei", "Hiragino Sans GB", "Heiti SC", "WenQuanYi Micro Hei", sans-serif;
            color: #333;
            background-color: #fff;
            min-width: 1226px
        }

        a {
            color: #757575;
            text-decoration: none
        }

        a:hover {
            color: #ff6700;
            text-decoration: none
        }

        .clearfix {
            *zoom: 1
        }

        .clearfix:before,
        .clearfix:after {
            content: "
 ";display:table}.clearfix:after{clear:both}.hide{display:none !important}.ir{display:block;text-align:left;text-indent:-9999em;overflow:hidden;_zoom:1}.sep,.ndash{margin:0
 .25em;
            font-family: sans-serif
        }

        .container {
            width: 1226px;
            *zoom: 1;
            margin-right: auto;
            margin-left: auto
        }

        .container:before,
        .container:after {
            content: "";
            display: table
        }

        .container:after {
            clear: both
        }

        .row {
            margin-left: -14px;
            _margin-left: 0;
            *zoom: 1
        }

        .row:before,
        .row:after {
            content: "";
            display: table
        }

        .row:after {
            clear: both
        }

        .page-main {
            background: #f5f5f5
        }

        .span1,
        .span2,
        .span3,
        .span4,
        .span5,
        .span6,
        .span7,
        .span8,
        .span9,
        .span10,
        .span11,
        .span12,
        .span13,
        .span14,
        .span15,
        .span16,
        .span17,
        .span18,
        .span19,
        .span20 {
            float: left;
            margin-left: 14px;
            min-height: 1px
        }

        .span1 {
            width: 48px
        }

        .span2 {
            width: 110px
        }

        .span3 {
            width: 172px
        }

        .span4 {
            width: 234px
        }

        .span5 {
            width: 296px
        }

        .span6 {
            width: 358px
        }

        .span7 {
            width: 420px
        }

        .span8 {
            width: 482px
        }

        .span9 {
            width: 544px
        }

        .span10 {
            width: 606px
        }

        .span11 {
            width: 668px
        }

        .span12 {
            width: 730px
        }

        .span13 {
            width: 792px
        }

        .span14 {
            width: 854px
        }

        .span15 {
            width: 916px
        }

        .span16 {
            width: 978px
        }

        .span17 {
            width: 1040px
        }

        .span18 {
            width: 1102px
        }

        .span19 {
            width: 1164px
        }

        .span20 {
            width: 1226px
        }

        .span-first {
            _margin-left: 0
        }

        .offset1 {
            margin-left: 48px
        }

        .offset2 {
            margin-left: 110px
        }

        .offset3 {
            margin-left: 172px
        }

        .offset4 {
            margin-left: 234px
        }

        .offset5 {
            margin-left: 296px
        }

        .offset6 {
            margin-left: 358px
        }

        .offset7 {
            margin-left: 420px
        }

        .offset8 {
            margin-left: 482px
        }

        .offset9 {
            margin-left: 544px
        }

        .offset10 {
            margin-left: 606px
        }

        .offset11 {
            margin-left: 668px
        }

        .offset12 {
            margin-left: 730px
        }

        .offset13 {
            margin-left: 792px
        }

        .offset14 {
            margin-left: 854px
        }

        .offset15 {
            margin-left: 916px
        }

        .offset16 {
            margin-left: 978px
        }

        .offset17 {
            margin-left: 1040px
        }

        .offset18 {
            margin-left: 1102px
        }

        .offset19 {
            margin-left: 1164px
        }

        .offset20 {
            margin-left: 1226px
        }
小米官网css初始化

待补充--

原文地址:https://www.cnblogs.com/EricZLin/p/8820137.html