对于小型的网站来说,用这个并不会带来大的资源浪费,但如果是像Yahoo这种架构非常大的网站,必须要有选择地进行CSS重设,以减 少资源浪费。

正在使用CSS的你,用过CSS Reset吗?当然,或许你用了,却不知道正在用,比如你可能经常用到:

程序代码

 
    * { padding: ; margin: ; border: ; }

这也是一款CSS Reset的方法,让所有的选择器的padding、margin和border都设置成0。

这是一种强大的方法,也是最简单,最安全的方法,不过,也是 最占用资源的方法。

对于小型的网站来说,用这个并不会带来大的资源浪费,但如果是像Yahoo这种架构非常大的网站,刚需要有选择地进行CSS重设,以减 少资源浪费。

下面是Yahoo的CSS重设代码,也是受最多人喜爱的CSS Reset方法,YUI选择的方法是:

程序代码

 
    body,div,dl,dt,dd,ul,ol,li,h1,h2,h3,h4,h5,h6,pre,
form,fieldset,input,textarea,p,blockquote,th,td {
padding: ;
margin: ;
}
table {
border-collapse: collapse;
border-spacing: ;
}
fieldset,img {
border: ;
}
address,caption,cite,code,dfn,em,strong,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: %;
}
q:before,q:after {
content:"";
}
abbr,acronym { border: ;
}

OK,相信你也已经了解了CSS重设的目的,或许你也可以根据自己的喜好,写一个自己的CSS重设系统,毕竟大家的需求和习惯的不同的。而你可以参照下面的几款:

Ateneu Popular CSS Reset

程序代码

    html, body, div, span, applet, object, iframe, h1, h2, h3,
h4, h5, h6, p, blockquote, pre, a, abbr, acronym,
address, big, cite, code, del, dfn, em, font, img, ins,
kbd, q, s, samp, small, strike, strong, sub, sup, tt,
var, dl, dt, dd, ol, ul, li, fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td {
margin: ;
padding: ;
border: ;
outline: ;
font-weight: inherit;
font-style: inherit;
font-size: %;
font-family: inherit;
vertical-align: baseline;
}
:focus { outline: ;}
a, a:link, a:visited, a:hover, a:active{text-decoration:none}
table { border-collapse: separate;border-spacing: ;}
th, td {text-align: left; font-weight: normal;}
img, iframe {border: none; text-decoration:none;}
ol, ul {list-style: none;}
input, textarea, select, button {font-size: %;font-family: inherit;}
select {margin: inherit;}
hr {margin: ;padding: ;border: ;color: #;background-color: #;height: 1px}

Chris Poteet’s Reset CSS

    * {
vertical-align: baseline;
font-family: inherit;
font-style: inherit;
font-size: %;
border: none;
padding: ;
margin: ;
}
body {
padding: 5px;
}
h1, h2, h3, h4, h5, h6, p, pre, blockquote, form, ul, ol, dl {
margin: 20px ;
}
li, dd, blockquote {
margin-left: 40px;
}
table {
border-collapse: collapse;
border-spacing: ;
}
Eric Meyer Reset CSS
程序代码
html, body, div, span, applet, object, iframe, table, caption,
tbody, tfoot, thead, tr, th, td, del, dfn, em, font, img, ins,
kbd, q, s, samp, small, strike, strong, sub, sup, tt, var,
h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr,
acronym, address, big, cite, code, dl, dt, dd, ol, ul, li,
fieldset, form, label, legend {
vertical-align: baseline;
font-family: inherit;
font-weight: inherit;
font-style: inherit;
font-size: %;
outline: ;
padding: ;
margin: ;
border: ;
}
:focus {
outline: ;
}
body {
background: white;
line-height: ;
color: black;
}
ol, ul {
list-style: none;
}
table {
border-collapse: separate;
border-spacing: ;
}
caption, th, td {
font-weight: normal;
text-align: left;
}
blockquote:before, blockquote:after, q:before, q:after {
content: "";
}
blockquote, q {
quotes: "" "";
}

程序代码

Tantek Celik Reset CSS

    :link,:visited { text-decoration:none }
ul,ol { list-style:none }
h1,h2,h3,h4,h5,h6,pre,code { font-size:1em; }
ul,ol,li,h1,h2,h3,h4,h5,h6,pre,form,body,html,p,blockquote,fieldset,input
{ margin:; padding: }
a img,:link img,:visited img { border:none }
address { font-style:normal }

Christian Montoya Reset CSS

程序代码

    html, body, form, fieldset {
margin: ;
padding: ;
font: %/% Verdana, Arial, Helvetica, sans-serif;
}
h1, h2, h3, h4, h5, h6, p, pre,
blockquote, ul, ol, dl, address {
margin: 1em ;
padding: ;
}
li, dd, blockquote {
margin-left: 1em;
}
form label {
cursor: pointer;
}
fieldset {
border: none;
}
input, select, textarea {
font-size: %;
font-family: inherit;
}

Rudeworks Reset CSS

    * {
margin: ;
padding: ;
border: none;
}
html {
font: 62.5% “Lucida Grande”, Lucida, Verdana, sans-serif;
text-shadow: # 0px 0px 0px;
}
ul {
list-style: none;
list-style-type: none;
}
h1, h2, h3, h4, h5, h6, p, pre,
blockquote, ul, ol, dl, address {
font-weight: normal;
margin: 1em ;
}
cite, em, dfn {
font-style: italic;
}
sup {
position: relative;
bottom: .3em;
vertical-align: baseline;
}
sub {
position: relative;
bottom: -.2em;
vertical-align: baseline;
}
li, dd, blockquote {
margin-left: 1em;
}
code, kbd, samp, pre, tt, var, input[type='text'], textarea {
font-size: %;
font-family: monaco, “Lucida Console”, courier, mono-space;
}
del {
text-decoration: line-through;
}
ins, dfn {
border-bottom: 1px solid #ccc;
}
small, sup, sub {
font-size: %;
}
abbr, acronym {
text-transform: uppercase;
font-size: %;
letter-spacing: .1em;
border-bottom-style: dotted;
border-bottom-width: 1px;
}
a abbr, a acronym {
border: none;
}
sup {
vertical-align: super;
}
sub {
vertical-align: sub;
}
h1 {
font-size: 2em;
}
h2 {
font-size: .8em;
}
h3 {
font-size: .6em;
}
h4 {
font-size: .4em;
}
h5 {
font-size: .2em;
}
h6 {
font-size: 1em;
}
a, a:link, a:visited, a:hover, a:active {
outline: ;
text-decoration: none;
}
a img {
border: none;
text-decoration: none;
}
img {
border: none;
text-decoration: none;
}
label, button {
cursor: pointer;
}
input:focus, select:focus, textarea:focus {
background-color: #FFF;
}
fieldset {
border: none;
}
.clear {
clear: both;
}
.float-left {
float: left;
}
.float-right {
float: right;
}
body {
text-align: center;
}
#wrapper {
margin: auto;
text-align: left;
}

Anieto2K Reset CSS

程序代码

    html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p,
blockquote, pre, a, abbr, acronym, address, big,
cite, code, del, dfn, em, font, img,
ins, kbd, q, s, samp, small, strike,
strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
center, u, b, i {
margin: ;
padding: ;
border: ;
outline: ;
font-weight: normal;
font-style: normal;
font-size: %;
font-family: inherit;
vertical-align: baseline
}
body {
line-height:
}
:focus {
outline:
}
ol, ul {
list-style: none
}
table {
border-collapse: collapse;
border-spacing:
}
blockquote:before, blockquote:after, q:before, q:after {
content: “”
}
blockquote, q {
quotes: “” “”
}
input, textarea {
margin: ;
padding:
}
hr {
margin: ;
padding: ;
border: ;
color: #;
background-color: #;
height: 1px
}

CSSLab CSS Reset

程序代码

 
    html, body, div, span, applet, object, iframe, h1, h2, h3,
h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address,
big, cite, code, del, dfn, em, font, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var, dl, dt, dd, ol, ul, li,
fieldset, form, label, legend, table, caption, tbody, tfoot,
thead, tr, th, td {
margin: ;
padding: ;
border: ;
outline: ;
font-weight: inherit;
font-style: inherit;
font-size: %;
font-family: inherit;
vertical-align: baseline;
}
:focus {
outline: ;
}
table {
border-collapse: separate;
border-spacing: ;
}
caption, th, td {
text-align: left;
font-weight: normal;
}
a img, iframe {
border: none;
}
ol, ul {
list-style: none;
}
input, textarea, select, button {
font-size: %;
font-family: inherit;
}
select {
margin: inherit;
}
/* Fixes incorrect placement of numbers in ol’s in IE6/7 */
ol { margin-left:2em; }
/* == clearfix == */
.clearfix:after {
content: “.”;
display: block;
height: ;
clear: both;
visibility: hidden;
}
.clearfix {display: inline-block;}
* html .clearfix {height: %;}
.clearfix {display: block;}

简单介绍几个CSSReset的方法的更多相关文章

  1. Spring进阶之路(10)-Advice简单介绍以及通过cglib生成AOP代理对象

    Advice简单介绍 1. Before:在目标方法运行之前运行织入.假设Before的处理中没有进行特殊的处理.那么目标方法终于会运行,可是假设想要阻止目标方法运行时.能够通过抛出一个异常来实现.B ...

  2. Oracle创建自增字段方法-ORACLE SEQUENCE的简单介绍

    引用自 :http://www.2cto.com/database/201307/224836.html   Oracle创建自增字段方法-ORACLE SEQUENCE的简单介绍 先假设有这么一个表 ...

  3. InputStreamReader 和 OutputStreamWriter类使用方法简单介绍,及演示。

    InputStreamReader 和 OutputStreamWriter类使用方法简单介绍. 一.InputStreamReader类 InputStreamReader 将字节流转换为字符流.是 ...

  4. Core文件简单介绍及生成设置方法

    Core文件简单介绍及生成设置方法 Core文件其实就是内存的映像,当程序崩溃时,存储内存的相应信息,主用用于对程序进行调试.当程序崩溃时便会产生core文件,其实准确的应该说是core dump 文 ...

  5. layui框架中关于table方法级渲染和自动化渲染之间的区别简单介绍

    方法级渲染: <table class="layui-hide" id="LAY_table_user" lay-filter="user&qu ...

  6. DBMS_OUTPUT.PUT_LINE()方法的简单介绍

    1.最基本的DBMS_OUTPUT.PUT_LINE()方法. 随便在什么地方,只要是BEGIN和END之间,就可以使用DBMS_OUTPUT.PUT_LINE(output);然而这会有一个问题,就 ...

  7. HTTP请求方式中8种请求方法(简单介绍)

    简单介绍 HTTP是超文本传输协议,其定义了客户端与服务器端之间文本传输的规范.HTTP默认使用80端口,这个端口指的是服务端的端口,而客户端使用的端口是动态分配的.当我们没有指定端口访问时,浏览器会 ...

  8. requests库的使用、安装及方法的简单介绍

    requests库的使用.安装及方法的简单介绍 1.requests库的概述 requests库是一个简洁且简单的处理HTTP请求的第三方库,是公认的最好获得第三方信息的库. requests库更多信 ...

  9. Android平台Camera实时滤镜实现方法探讨(十)--代码地址以及简单介绍(20160118更新)

    简单做了个相机和图片编辑模块,时间原因非常多功能还没有做.尚有BUG,见谅,将在以后抽时间改动 代码地址 PS:请点个Star^-^ --------------------------------- ...

随机推荐

  1. 基于baseline、svd和stochastic gradient descent的个性化推荐系统

    文章主要介绍的是koren 08年发的论文[1],  2.3部分内容(其余部分会陆续补充上来).koren论文中用到netflix 数据集, 过于大, 在普通的pc机上运行时间很长很长.考虑到写文章目 ...

  2. visio去除直线交叉处的歪曲

    1 问题描述 Visio画图时,两根直线交叉时,总是默认会出现一个跨线的标志,如下图所示: 2 解决办法 在2007前的版本,可以通过以下方式解决: 选中线条,然后菜单的格式->行为->连 ...

  3. Redis高级命令的使用学习

  4. spring boot项目搭建中遇到的问题

    自己动手搭建一下spring boot的项目,中途遇到了几个问题,在这里记录一下! 一.关于数据库中的表设计的问题 1.设计表的时候一定要添加的两个字段created updated 创建时间与更新时 ...

  5. linux学习(一)-----vm、centos安装

    安装vm和Centos 1)先安装 virtual machine ,vm12 2)再安装 Linux (CentOS 6.8) 3)原理示意图,这里我们画图说明一下 VM 和 CentOS 的关系. ...

  6. python冒泡排序算法的实现代码

    python冒泡排序算法的实现代码 这篇文章主要介绍了python冒泡排序算法的实现代码,大家参考使用 1.算法描述: (1)共循环 n-1 次 (2)每次循环中,如果 前面的数大于后面的数,就交换 ...

  7. Composer安装Yii2以及相关扩展

    1.安装redis扩展 命令:composer require yiisoft/yii2-redis Git地址:https://github.com/yiisoft/yii2-redis/blob/ ...

  8. java记录CST时间类型的字符串转换问题

    下列代码可以实现把Java的CST格式的时间字符串转为为Date对象和所需要的日期时间格式! String dateStr = "Wed Sep 16 11:26:23 CST 2009&q ...

  9. java 集合存储对象且根据对象属性排序

    方法一:根据java1.8lambda表达式进行排序 Comparator<RateInfo> comparator = (t1, t2) -> t1.getRateCode().c ...

  10. 02Redis入门指南笔记(基本数据类型)

    一:热身 获得符合规则的健名列表:keys  pattern pattern支持glob风格的通配符,具体规则如下表: Redis命令不区分大小写.keys命令需要遍历Redis中的所有健,当键的数量 ...