为什么要初始化CSS?

CSS初始化是指重设浏览器的样式。不同的浏览器默认的样式可能不尽相同,所以开发时的第一件事可能就是如何把它们统一。如果没对CSS初始化往往会出现浏览器之间的页面差异。每次新开发网站或新网页时候通过初始化CSS样式的属性,为我们将用到的CSS或html标签更加方便准确,使得我们开发网页内容时更加方便简洁,同时减少CSS代码量,节约网页下载时间。

CSS初始化示例代码

/* css reset www.admin10000.com */
body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form,fieldset,legend,input,button,textarea,p,blockquote,th,td { margin:0; padding:0; }
body { background:#fff; color:#555; font-size:14px; font-family: Verdana, Arial, Helvetica, sans-serif; }
td,th,caption { font-size:14px; }
h1, h2, h3, h4, h5, h6 { font-weight:normal; font-size:100%; }
address, caption, cite, code, dfn, em, strong, th, var { font-style:normal; font-weight:normal;}
a { color:#555; text-decoration:none; }
a:hover { text-decoration:underline; }
img { border:none; }
ol,ul,li { list-style:none; }
input, textarea, select, button { font:14px Verdana,Helvetica,Arial,sans-serif; }
table { border-collapse:collapse; }
html {overflow-y: scroll;}
/* css common */
.clearfix:after {content: "."; display: block; height:0; clear:both; visibility: hidden;}
.clearfix { *zoom:1; }

腾讯QQ官网 样式初始化

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;}

淘宝官网 样式初始化

body, h1, h2, h3, h4, h5, h6, hr, p, blockquote, dl, dt, dd, ul, ol, li, pre, form, fieldset, legend, button, input, textarea, th, td { margin:0; padding:0; }
body, button, input, select, textarea { font:12px/1.5tahoma, arial, \5b8b\4f53; }
h1, h2, h3, h4, h5, h6{ font-size:100%; }
address, cite, dfn, em, var { font-style:normal; }
code, kbd, pre, samp { font-family:couriernew, courier, monospace; }
small{ font-size:12px; }
ul, ol { list-style:none; }
a { text-decoration:none; }
a:hover { text-decoration:underline; }
sup { vertical-align:text-top; }
sub{ vertical-align:text-bottom; }
legend { color:#000; }
fieldset, img { border:0; }
button, input, select, textarea { font-size:100%; }
table { border-collapse:collapse; border-spacing:0; }

网易官网 样式初始化

html {overflow-y:scroll;}
body {margin:0; padding:29px00; font:12px"\5B8B\4F53",sans-serif;background:#ffffff;}
div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,fieldset,input,textarea,blockquote,p{padding:0; margin:0;}
table,td,tr,th{font-size:12px;}
li{list-style-type:none;}
img{vertical-align:top;border:0;}
ol,ul {list-style:none;}
h1,h2,h3,h4,h5,h6{font-size:12px; font-weight:normal;}
address,cite,code,em,th {font-weight:normal; font-style:normal;}

html模板,用于每次新开发页面使用

<!DOCTYPE html>
<html>
<head>
<title>网站标题 - Admin10000.com </title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="zh-CN" />
<meta name="Author" content="网页作者" />
<meta name="Copyright" content="网站版权" />
<meta name="keywords" content="网站关键字" />
<meta name="description" content="网站描述" />
<link rel="Shortcut Icon" href="网站.ico图标路径" />
<link type="text/css" rel="stylesheet" href="CSS文件路径" />
<script type="text/javascript" src="JS文件路径"></script>
</head>
<body>
</body>
</html>

CSS初始化样式的更多相关文章

  1. css初始化样式代码

    为什么要初始化CSS? CSS初始化是指重设浏览器的样式.不同的浏览器默认的样式可能不尽相同,所以开发时的第一件事可能就是如何把它们统一.如果没对CSS初始化往往会出现浏览器之间的页面差异.每次新开发 ...

  2. 常用css初始化样式(淘宝)

    最简单粗暴的css初始化样式就是:*{padding:0:margin:0}(不推荐) 淘宝的样式初始化: body, h1, h2, h3, h4, h5, h6, hr, p, blockquot ...

  3. 一套常用的css初始化样式

    @charset "UTF-8"; /*css 初始化 */ html, body, ul, li, ol, dl, dd, dt, p, h1, h2, h3, h4, h5, ...

  4. css 初始化样式

    @charset "UTF-8"; /* reset */ html,body,div,h1,h2,h3,h4,h5,h6,p,dl,dt,dd,ol,ul,li,fieldset ...

  5. css的初始化样式

    一切为了敏捷开发: http://blog.sina.com.cn/s/blog_71ed1b870101a52w.html CSS初始化示例代码 /* css reset www.admin1000 ...

  6. css公共样式 | 标签元素初始化

    PC参考样式1: @charset "utf-8"; html{background:#fff;overflow:auto;} body{min-width:1200px;font ...

  7. 移动端(视口(meta),像素比,二倍图(图片,背景图,精灵图),css初始化(normalize.css),特殊样式,常见屏幕尺寸)

    1. 视口:(布局视口(layout viewport),视觉视口(visual viewport),理想视口(ideal viewport)) meta 视口标签 <meta  name = ...

  8. recent.css常用的页面初始化样式

    <style> @charset "utf-8"; body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,code,form ...

  9. 各大门户网站的css初始化代码

    腾讯QQ官网 css样式初始 body,ol,ul,h1,h2,h3,h4,h5,h6,p,th,td,dl,dd,form,fieldset,legend,input,textarea,select ...

随机推荐

  1. 使用 VS Code 来编辑 markdown 文章

    一开始我就用 VS Code 来编辑 markdown 文本,只是因为 VS Code 用起来感觉很好,然后我又去寻找其他的能够预览 markdown 的编辑器,看了好多都不是很方便.突然我发现 VS ...

  2. Learning to rank 介绍

    PS:文章主要转载自CSDN大神hguisu的文章"机器学习排序":          http://blog.csdn.net/hguisu/article/details/79 ...

  3. ORB-SLAM(一)简介

    ORB-SLAM是一种基于ORB特征的三维定位与地图构建算法(SLAM)[1].该算法由Raul Mur-Artal,J. M. M. Montiel和Juan D. Tardos于2015年发表在I ...

  4. end2end learning 端到端学习

    在DeepLearning的文章中有看到end2end一次,作者们似乎都比较喜欢这个end2end learning的方式.那么到底啥是end2end? 找了一下相关论文,没找到专门讲这个概念的,看来 ...

  5. 下载imagenet2012数据集

    摸索了一下,imagenet2012下载,跟大家分享一下 用迅雷会员加速都可以下载,有的用百度云也可以离线下载 http://www.image-net.org/challenges/LSVRC/20 ...

  6. 【Codefoces487E/UOJ#30】Tourists Tarjan 点双连通分量 + 树链剖分

    E. Tourists time limit per test: 2 seconds memory limit per test: 256 megabytes input: standard inpu ...

  7. iOS plist文件创建

    iOS中plist的创建,数据写入与读取功能创建一个test.plist文件,textInput作为输入,displayLabel作为显示,有一个按钮来触发保持程序triggerStorage: -( ...

  8. IOS定位

    #import "ViewController.h" #import <CoreLocation/CoreLocation.h> @interface ViewCont ...

  9. Windows的基本内容

    1, 进程间通信:是指进程间进行信息交换 低级方式:信号量通信(可以交换的信息量少的时候) 高级通信方式(3种):1.共享存储器系统(剪贴板) 2.消息传递系统(进程间的数据交换以消息(message ...

  10. lua c api

    #include <stdio.h> #include <string.h> extern "C"{ #include <lua.h> #inc ...