四线城市——前端成长日志

开发网页基础-base.css(重置CSS样式)

2018-04-02  本文已影响0人  新为向前

很多人认为不用重置样式,对应着写不会出现什么问题,但是开发的时候避免因为样式的开发出现BUG,事先还是要重置样式!


1. 什么是base.css?

/*css reset*/


/*重置清除样式*/

body,
div,
dl,
dt,
dd,
ul,
ol,
li,
h1,
h2,
h3,
h4,
h5,
h6,
pre,
form,
fieldset,
input,
textarea,
p,
blockquote,
th,
td {
    margin: 0;
    padding: 0;
}

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

fieldset,
img {
    border: 0;
}

address,
caption,
cite,
code,
dfn,
em,
strong,
th,
var {
    font-style: normal;
    font-weight: normal;
}

ol,
ul {
    list-style: none;
}

caption,
th {
    text-align: left;
}

h1,
h2,
h3,
h4,
h5,
h6 {
    font-size: 100%;
    font-weight: normal;
}

q:before,
q:after {
    content: ".";
}

abbr,
acronym {
    border: 0;
}

li {
    list-style: none;
}

a,
img {
    border: none;
    margin: 0;
}

body {
    height: auto;
    font-family: "微软雅黑", Helvetica Neue, Helvetica, Arial, sans-serif !important;
}

input,
select,
textarea {
    font-family: "微软雅黑", Helvetica Neue, Helvetica, Arial, sans-serif;
    outline: none;
    vertical-align: middle;
}

i,
b,
strong {
    font-weight: normal;
    font-style: normal;
}

a {
    text-decoration: none;
    cursor: pointer;
/*手机端点中去除选中颜色*/
    -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
    tap-highlight-color: rgba(0, 0, 0, 0);
}

a:link,
a:hover,
a:visited,
a:active,
a:focus {
    text-decoration: none;
    outline: none;
}

*html {
    background-image: url(about:blank);
    background-attachment: fixed;
}


/*兼容IE6定位抖动的*/


/*字体排版*/

.f12 {
    font-size: 12px;
}

.f13 {
    font-size: 13px;
}

.f14 {
    font-size: 14px;
}

.f16 {
    font-size: 16px;
}

.f18 {
    font-size: 18px;
}

.f20 {
    font-size: 20px;
}

.fb {
    font-weight: bold;
}

.fn {
    font-weight: normal;
}

.t2 {
    text-indent: 2em;
}

.lh150 {
    line-height: 150%;
}

.lh180 {
    line-height: 180%;
}

.lh200 {
    line-height: 200%;
}

.unl {
    text-decoration: underline;
}

.no_unl {
    text-decoration: none;
}


/*定位*/

.tl {
    text-align: left;
}

.tr {
    text-align: right;
}

.tc {
    text-align: center;
}

.bc {
    margin-left: auto;
    margin-right: auto;
}

.fl {
    float: left;
    display: inline;
}

.fr {
    float: right;
    display: inline;
}

html {
    width: 100%;
    -webkit-text-size-adjust: none;
    -moz-text-size-adjust: none;
    -ms-text-size-adjust: none;
    -o-text-size-adjust: none;
    text-size-adjust: none;
}


/*盒子样式*/
/*请了解清楚这行盒子模型的理解再使用
*
*/
*,
*:after,
*:before {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    -ms-box-sizing: border-box;
    -o-box-sizing: border-box;
    box-sizing: border-box;
}
/*
*
*/
.cb {
    clear: both;
}

.cl {
    clear: left;
}

.cr {
    clear: right;
}

.clearfix:after {
    content: ".";
    display: block;
    height: 0;
    clear: both;
    visibility: hidden;
}

.clearfix {
    display: inline-block;
}

*html.clearfix {
    height: 1%;
}

.Clearfix {
    display: block;
}

.vm {
    vertical-align: middle;
}

.pr {
    position: relative;
}

.pa {
    position: absolute;
}

.abs-right {
    position: absolute;
    right: 0;
}

.zoom {
    *zoom: 1;
}

.hidden {
    visibility: hidden;
}

.none {
    display: none;
}


/*长度宽度*/

.w10 {
    width: 10px;
}

.w20 {
    width: 20px;
}

.w40 {
    width: 40px;
}

.w60 {
    width: 60px;
}

.w80 {
    width: 80px;
}

.w100 {
    width: 100px;
}

.w200 {
    width: 200px;
}

.w260 {
    width: 260px;
}

.w400 {
    width: 400px;
}

.w600 {
    width: 600px;
}

.w800 {
    width: 800px;
}

.w {
    width: 100%;
}

小结

上一篇 下一篇

猜你喜欢

热点阅读