ITPub博客

首页 > 应用开发 > Html/css > 好程序员web前端分享css初始化代码

好程序员web前端分享css初始化代码

原创 Html/css 作者:好程序员IT 时间:2019-04-18 16:58:19 0 删除 编辑

    好程序员 web 前端分享 css 初始化代码 , CSS 初始化是指重设浏览器的样式。不同的浏览器默认的样式可能不尽相同,

 

所以开发时的第一件事可能就是如何把它们统一。

 

如果没对 CSS 初始化往往会出现浏览器之间的页面差异。

 

每次新开发网站或新网页时候通过初始化 CSS 样式的属性,

 

为我们将用到的 CSS 或 html 标签更加方便准确,

 

使得我们开发网页内容时更加方便简洁,

 

同时减少 css 代码量,节约网页下载时间。

 

 

 

  /*css reset code */

 

 

  /**** 文字大小初始化 , 使 1em=10px *****/

 

 

  body {

 

  font-size:62.5%;

 

 

  } /* for IE/Win */

 

 

  html>body {

 

 

  font-size:10px;

 

 

  } /* for everything else */

 

 

  /* 字体边框等初始化 */

 

 

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

 

 

  padding: 0;

 

 

  margin: 0;

 

 

  }

 

 

  table {

 

 

  border-collapse: collapse;

 

 

  border-spacing: 0;

 

 

  }

 

 

  fieldset,img {

 

 

  border: 0;

 

 

  }

 

 

  img {

 

 

  display:block;

 

 

  }

 

 

  address,caption,cite,code,dfn,th,var {

 

 

  font-weight: normal;

 

 

  font-style: normal;

 

 

  }

 

 

  ol,ul {

 

 

  list-style: none;

 

 

  }

 

 

  caption,th {

 

 

  text-align: left;

 

 

  }

 

 

  h1,h2,h3,h4,h5,h6 {

 

 

  font-weight: normal;

 

 

  font-size: 100%;

 

 

  }

 

 

  q:before,q:after {

 

 

  content:'';

 

 

  }

 

 

  abbr,acronym { border: 0;

 

 

  }

 

 

  a {

 

 

  text-decoration:none;

 

 

  }

 

 

  body,ol,ul,h1,h2,h3,h4,h5,h6,p,th,td,dl,dd,form,fieldset,legend,input,textarea,select{margin:0;padding:0}

 

 

  body{font:12px" 宋体 ","Arial Narrow",HELVETICA;background:#fff;-webkit-text-size-adjust:100%;}

 

    a{color:#2d374b;text-decoration:none}

 

  a:hover{color:#cd0200;text-decoration:underline}

 

 

  em{font-style:normal}

 

 

  li{list-style:none}

 

 

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

 

 

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

 

 

 

  p{word-wrap:break-word}

 

 

  body,ul,ol,li,p,h1,h2,h3,h4,h5,h6,form,fieldset,table,td,img,div{margin:0;padding:0;border:0;}

 

 

  body{background:#fff;color:#333;font-size:12px; margin-top:5px;font-family:"SimSun"," 宋体 ","Arial Narrow";}

 

 

  ul,ol{list-style-type:none;}

 

 

  select,input,img,select{vertical-align:middle;}

 

 

  a{text-decoration:none;}

 

 

  a:link{color:#009;}

 

 

  a:visited{color:#800080;}

 

 

 

  a:hover,a:active,a:focus{color:#c00;text-decoration:underline;}


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/69913892/viewspace-2641816/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
欢迎关注公众号:好程序员特训营 web前端教程分享 723729549 大数据教程分享 703503210

注册时间:2019-03-20

  • 博文量
    539
  • 访问量
    410770