css笔记22(初始化)

不同浏览器的初始值不同为了兼容性而要进行初始化

初始化:

1.内外边距清零

* {
    margin: 0;
    padding: 0
}

2.斜体文字不倾斜

em,
i {
    font-style: normal
}

3.去除无序列表的小圆点

li {
    list-style: none
}

3.图片取消底部空白,防止低版本浏览器在带链接的图片上加边框

img {
    border: 0;
    vertical-align: middle
}

4.鼠标经过按钮时,鼠标变成小手

button {
    cursor: pointer
}

5.链接颜色取消下划线,当鼠标经过时,链接颜色改变。

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

a:hover {
    color: #c81623
}

7.按钮设置字体(中文字体用编码表示“\5B8B\4F53”就是宋体)

button,
input {
    font-family: Microsoft YaHei, Heiti SC, tahoma, arial, Hiragino Sans GB, "\5B8B\4F53", sans-serif
}

8.抗锯齿性即其他默认的页面设置

body {
    -webkit-font-smoothing: antialiased;
    background-color: #fff;
    font: 12px/1.5 Microsoft YaHei, Heiti SC, tahoma, arial, Hiragino Sans GB, "\5B8B\4F53", sans-serif;
    color: #666
}

9.将隐藏标签的元素隐藏

.hide,
.none {
    display: none
}

10.清除浮动

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

.clearfix {
    *zoom: 1
}

附:

京东的初始化css

* {
    margin: 0;
    padding: 0
}

em,
i {
    font-style: normal
}

li {
    list-style: none
}

img {
    border: 0;
    vertical-align: middle
}

button {
    cursor: pointer
}

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

a:hover {
    color: #c81623
}

button,
input {
    font-family: Microsoft YaHei, Heiti SC, tahoma, arial, Hiragino Sans GB, "\5B8B\4F53", sans-serif
}

body {
    -webkit-font-smoothing: antialiased;
    background-color: #fff;
    font: 12px/1.5 Microsoft YaHei, Heiti SC, tahoma, arial, Hiragino Sans GB, "\5B8B\4F53", sans-serif;
    color: #666
}

.hide,
.none {
    display: none
}

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

.clearfix {
    *zoom: 1
}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值