项目中css的初始化

一、目的:为了消除各浏览器对css默认的设置,保持网页在各浏览器中的外观保持一致

1./* 把我们所有标签的内外边距边框清零,盒子为边框盒型,不会因为padding而变大 */

* {
    margin: 0;
    padding: 0;
    boder:0
    box-sizing: border-box;
}

(不建议,这样会加重网页渲染性能)



建议把项目中用到的标签都列出来,例如

body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,legend,button
form,fieldset,input,textarea,p,blockquote,th,td {   
  padding: 0;   
  margin: 0; 
    boder:0
    box-sizing: border-box;
}



/* 设置网页统一的字体大小、行高、字体系列相关属性 */
body {
  font: 16px/1.5 "Helvetica Neue", Helvetica, Arial, "Microsoft Yahei",
    "Hiragino Sans GB", "Heiti SC", "WenQuanYi Micro Hei", sans-serif;
  color: #333;
}


/* 去除默认的倾斜效果 */
em,
i {
  font-style: normal;
}



2./* 清除列表样式 */

ol,ul {list-style: none;}

3.img {
    /* 取消图片底侧有空白缝隙的问题 */
    vertical-align: middle(也可以display:block)
}

button,input {
    /* 当我们鼠标经过button 按钮的时候,鼠标变成小手,并且去除轮廓线,设置文字颜色 */
    cursor: pointer;
    outline: none;
    color: #333;
}

/* 左浮动 */
.fl {
  float: left;
}

/* 右浮动 */
.fr {
  float: right;
}


a {

//清除a的下划线,并设置默认文字颜色
    text-decoration: none
    color: #333;

}

/* 双伪元素清除法 */
.clearfix::before,
.clearfix::after {
  content: "";
  display: table;
}

.clearfix::after {
  clear: both;
}

//项目的版心 

 .w {
    width: 1200px;
    margin: 0 auto;
}

/* 设置表格的边框被合并为一个单一的边框, 指定分隔边框模型中单元格边界之间的距离为0*/
table {   
  border-collapse: collapse;   
  border-spacing: 0;   
} 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Cirrod

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值