web前端优秀程序员分享css初始化代码,CSS初始化指的是重新设置浏览器的样式。不同的浏览器默认的样式可能不一样,所以开发的时候首先要做的可能就是如何统一。如果CSS未初始化,浏览器之间的页面差异往往会发生。每次新开发一个新的网站或网页,通过初始化CSS样式的属性,让我们将要使用的CSS或html标签更加方便和准确,让我们开发网页内容更加方便和简洁,同时减少了css代码量,节省了网页下载时间。 /css重置代码/ /文字大小初始化,使1em=10px*/ body{ font-size:62.5%; }/forIE/Win/ html>body{ font-size:10px; }/其他的/ /字体框架初始化/ body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,p,blockquote,th,td{ 填充:0; 边距:0; } 表格{ 边界折叠:折叠; 边界间距:0; } fieldset,img{ 边界:0; } img{ display:block; } address,caption,cite,code,dfn,th,var{ 字体粗细:正常; 字体样式:正常; } 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{ 文本装饰:无; } 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"宋体","ArialNarrow",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{背景:#fff;颜色:#333;字体大小:12px;margin-top:5px;font-family:"SimSun","宋体","ArialNarrow";} 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;}
