简单介绍几个CSSReset的方法

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

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

程序代码

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

这也是一款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: 0;
margin: 0;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
fieldset,img {
border: 0;
}
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: 100%;
}
q:before,q:after {
content:"";
}
abbr,acronym { border: 0;
}

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: 0;
padding: 0;
border: 0;
outline: 0;
font-weight: inherit;
font-style: inherit;
font-size: 100%;
font-family: inherit;
vertical-align: baseline;
}
:focus { outline: 0;}
a, a:link, a:visited, a:hover, a:active{text-decoration:none}
table { border-collapse: separate;border-spacing: 0;}
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: 100%;font-family: inherit;}
select {margin: inherit;}
hr {margin: 0;padding: 0;border: 0;color: #000;background-color: #000;height: 1px}

Chris Poteet’s Reset CSS


    * {
vertical-align: baseline;
font-family: inherit;
font-style: inherit;
font-size: 100%;
border: none;
padding: 0;
margin: 0;
}
body {
padding: 5px;
}
h1, h2, h3, h4, h5, h6, p, pre, blockquote, form, ul, ol, dl {
margin: 20px 0;
}
li, dd, blockquote {
margin-left: 40px;
}
table {
border-collapse: collapse;
border-spacing: 0;
}
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: 100%;
outline: 0;
padding: 0;
margin: 0;
border: 0;
}
:focus {
outline: 0;
}
body {
background: white;
line-height: 1;
color: black;
}
ol, ul {
list-style: none;
}
table {
border-collapse: separate;
border-spacing: 0;
}
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:0; padding:0 }
a img,:link img,:visited img { border:none }
address { font-style:normal }

Christian Montoya Reset
CSS

程序代码


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

Rudeworks Reset CSS


    * {
margin: 0;
padding: 0;
border: none;
}
html {
font: 62.5% “Lucida Grande”, Lucida, Verdana, sans-serif;
text-shadow: #000 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: 0 0 1em 0;
}
cite, em, dfn {
font-style: italic;
}
sup {
position: relative;
bottom: 0.3em;
vertical-align: baseline;
}
sub {
position: relative;
bottom: -0.2em;
vertical-align: baseline;
}
li, dd, blockquote {
margin-left: 1em;
}
code, kbd, samp, pre, tt, var, input[type=‘text‘], textarea {
font-size: 100%;
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: 85%;
}
abbr, acronym {
text-transform: uppercase;
font-size: 85%;
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: 1.8em;
}
h3 {
font-size: 1.6em;
}
h4 {
font-size: 1.4em;
}
h5 {
font-size: 1.2em;
}
h6 {
font-size: 1em;
}
a, a:link, a:visited, a:hover, a:active {
outline: 0;
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: 0 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: 0;
padding: 0;
border: 0;
outline: 0;
font-weight: normal;
font-style: normal;
font-size: 100%;
font-family: inherit;
vertical-align: baseline
}
body {
line-height: 1
}
:focus {
outline: 0
}
ol, ul {
list-style: none
}
table {
border-collapse: collapse;
border-spacing: 0
}
blockquote:before, blockquote:after, q:before, q:after {
content: “”
}
blockquote, q {
quotes: “” “”
}
input, textarea {
margin: 0;
padding: 0
}
hr {
margin: 0;
padding: 0;
border: 0;
color: #000;
background-color: #000;
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: 0;
padding: 0;
border: 0;
outline: 0;
font-weight: inherit;
font-style: inherit;
font-size: 100%;
font-family: inherit;
vertical-align: baseline;
}
:focus {
outline: 0;
}
table {
border-collapse: separate;
border-spacing: 0;
}
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: 100%;
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: 0;
clear: both;
visibility: hidden;
}
.clearfix {display: inline-block;}
* html .clearfix {height: 1%;}
.clearfix {display: block;}

简单介绍几个CSSReset的方法,布布扣,bubuko.com

时间: 2024-08-09 20:39:45

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

介绍遍历子表的方法

在表单中,控件类型为子表的数据项,其对于的前台代码其实就是Table 下面简单介绍遍历子表的方法 循环子表取.赋值方法: //此方法的功能是将子表TravelExpensesList复制到子表FinancialAudit中 //步骤解析: //1.取到子表FinancialAudit的总行数 //2.由于是将子表TravelExpensesList复制到子表FinancialAudit中,也就是子表TravelExpensesList是有值的,而子表FinancialAudit是刚初始化的,没有

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

Advice简单介绍 1. Before:在目标方法运行之前运行织入.假设Before的处理中没有进行特殊的处理.那么目标方法终于会运行,可是假设想要阻止目标方法运行时.能够通过抛出一个异常来实现.Before处理无法拿到目标方法的返回值,由于这时候目标方法并未运行. 2. AfterReturning: 返回之后运行(前提是目标方法运行成功),能够訪问到目标对象的返回值.可是不能够改变返回值. 3. AfterThrowing:抛出异常之后运行.能够对异常进行适当的修复或者将异常输出到日志中.

一.SalesForce中Schema类的简单介绍

一.Schema以及Schema NameSpace是什么 在SalesForce中Schema指的是应用程序中对象(Object)以及对象之间的各种关系.Schema NameSpace中包含了好多的类和方法,通过这些类和方法,可以访问Schema的一些基本信息. 二.Schema常用的类和方法 在Schema NameSpace中包含了很多的类以及方法,在此并不会对所有的类和方法做介绍,只会对其中几个类的几个方法做简单介绍. 1.Schema.getGlobalDescribe方法``这个方

js按钮确认删除提示以及js的三种弹出框简单介绍

js按钮确认删除提示 第一种方法: html代码: 1 <a href="" οnclick="javascript:return del();">删除</a> js代码: 1 function del() { 2 var msg = "您真的确定要删除吗?\n\n请确认!"; 3 if (confirm(msg)==true){ 4 return true; 5 }else{ 6 return false; 7 } 8

CFileDialog的使用方法简单介绍

CFileDialog文件选择对话框的使用:首先构造一个对象并提供对应的參数,构造函数原型例如以下: CFileDialog::CFileDialog( BOOL bOpenFileDialog, LPCTSTR lpszDefExt = NULL, LPCTSTR lpszFileName = NULL, DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, LPCTSTR lpszFilter = NULL, CWnd* pParen

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

InputStreamReader 和 OutputStreamWriter类使用方法简单介绍. 一.InputStreamReader类 InputStreamReader 将字节流转换为字符流.是字节流通向字符流的桥梁.假设不指定字符集编码,该解码过程将使用平台默认的字符编码,如:GBK. 构造方法: InputStreamReader isr = new InputStreamReader(InputStream in);//构造一个默认编码集的InputStreamReader类 Inp

PHP在浏览器上跟踪调试的方法以及使用ChromePhp、FirePHP的简单介绍

之前用ThinkPHP时发现有个 trace 函数可以跟踪调试,感觉很有意思,网上搜索了下类似的东西,发现了 ChromePhp ,以前没想过这样来调试 PHP 程序,感觉非常方便,很有用. ThinkPHP 使用的是自己生成的 HTML 随模版一起输出来显示,偶尔会遇到一些莫名其妙的问题,效果不是太好, 还有一些也是类似的方法,但输出的主要是在模版中增加 JS 代码,调用浏览器的调试方法进行输出调试 如 console.log('PHP的一些调试输出内容'); ChromePhp 是通过hea

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

1.最基本的DBMS_OUTPUT.PUT_LINE()方法. 随便在什么地方,只要是BEGIN和END之间,就可以使用DBMS_OUTPUT.PUT_LINE(output);然而这会有一个问题,就是使用该函数一次最多只可以显示255个字符,否则缓冲区会溢出. 此外,函数DBMS_OUTPUT.ENABLE(20000)这种函数,仅仅是设置整个过程的全部输出缓冲区大小,而非DBMS_OUTPUT.PUT_LINE()的缓冲区大小. 对于超过255个字符的变量,使用DBMS_OUTPUT.PUT

实现跨域iframe接口方法调用 简单介绍

实现跨域iframe接口方法调用 简单介绍: 页面a.html域名为www.a.com,嵌入页面http://www.b.com/b.html. b.html要调用a.html中的js函数,由于两个页面不在一个域中,会提示没权限. 下面就介绍一下如何如何解决此问题,需要的朋友可以做一下参考. 一.cross.js代码如下: (function(global){ global.Cross = { signalHandler: {}, on: function(signal, func){ this