CSS重设(reset)方法总结

本文转自:http://www.cnblogs.com/hnyei/archive/2011/10/04/2198779.html



在当今网页设计/开发实践中,使用CSS来为语义化的(X)HTML标记添加样式风格是重要的关键。在设计师们的梦想中都存在着这样的一个完美世界:所有的浏览器都能够理解和适用多有CSS规则,并且呈现相同的视觉效果(没有兼容性问题)。但是,我们并没有生活在这个完美的世界,现实中发生的失窃却总是恰恰相反,很多CSS样式在不同的浏览器中有着不同的解释和呈现。

  当今流行的浏览器(如:Firefox、Opera、Internet Explorer、Chrome、Safari等等)中,有一些都是以自己的方式去理解CSS规范,这就会导致有的浏览器对CSS的解释与设计师的CSS定义初衷相冲突,使得网页的样子在某些浏览器下能正确按照设计师的想法显示,但有些浏览器却并没有按照设计师想要的样子显示出来,这就导致浏览器的兼容性问题。更糟的是,有的浏览器完全无视CSS的一些声明和属性。

  正因为上述冲突和问题依然存在于这个”不完美的世界”,所以一些设计师想到了一种避免浏览器兼容性问题的方法,那就是CSS Reset,什么是CSS Reset?我们可以把它叫做CSS重设,也有人叫做CSS复位、默认CSS、CSS重置等。CSS重设就是由于各种浏览器解释CSS样式的初始值有所不同,导致设计师在没有定义某个CSS属性时,不同的浏览器会按照自己的默认值来为没有定义的样式赋值,所以我们要先定义好一些CSS样式,来让所有浏览器都按照同样的规则解释CSS,这样就能避免发生这种问题。

一.最简化的CSS Reset(重设) :

* {
      padding: 0;
      margin: 0;
}
这是最普遍最简单的CSS重设,将所有元素的padding和margin值都设为0,可以避免一些浏览器在理解这两个属性默认值上的”分歧”。

* {
       padding: 0;
       margin: 0;
       border: 0;
}
 这是在上一个重设的基础上添加了对border属性的重设,初始值为0的确能避免一些问题。

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

 在前两个的基础上添加了outline属性的重设,防止一些冲突。


二.浓缩实用型CSS Reset(重设):

* {
       vertical-align: baseline;
       font-weight: inherit; 
       font-family: inherit; 
       font-style: inherit;
       font-size: 100%;
       outline: 0;
       padding: 0;
       margin: 0;
       border: 0;
}
该CSS重设方法出自Perishable Press,这是他常用的方法。


三.Poor Man 的CSS Reset:

html, body { 
       padding: 0; 
       margin: 0; 
}
html {
       font-size:1em;
} 
body {
       font-size:100%;
} 
a img, :link img, :visited img {
       border:0px;
} 
这个重设方法将html和body下元素的padding和margin都设为0,并分别为html标签和body标签下的所有元素设置了初始的字体大小,最重要的是把有链接的图片的默认边框去掉了。


四.Siolon’s Global Reset

* { 
    vertical-align: baseline;
    font-family: inherit;
    fo

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


五.Shaun Inman’s Global Reset

body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, form, fieldset, input, p, blockquote, table, th, td, embed, object {
    padding: 0;
    margin: 0; 
}
table {
    border-collapse: collapse;
    border-spacing: 0;
}
    fieldset, img, abbr {
    border: 0;
}
address, caption, cite, code, dfn, em, 
h1, h2, h3, h4, h5, h6, strong, th, var {
    font-weight: normal;
    font-style: normal;
}
ul {
    list-style: none;
}
caption, th {
    text-align: left;
}
h1, h2, h3, h4, h5, h6 {
    font-size: 1.0em;
}
q:before, q:after {
    content: ”;
}
a, ins {
    text-decoration: none;
}


六.Yahoo(YUI) CSS Reset:

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

七.Eric Meyer’s CSS Reset
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: “” “”; 
}



八.Condensed Meyer Reset:

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;
}
    fieldset, img { 
    border: 0;
}
table {
    border-collapse: collapse;
    border-spacing: 0;
}
ol, ul {
    list-style: none;
}
address, caption, cite, code, dfn, em, strong, th, var {
    font-weight: normal;
    font-style: normal;
}
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;
}


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


十一.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;}


这15套重设方法其实都是有共同点的,也许有的实现方法不同,但大部分都是同一个目的,就是为了让更多的浏览器能显示同样的效果。有了这些CSS重设作为资料和参考,也许会对你的工作有所帮助甚至提高效率,但是,毕竟这些重设都是别人写的,你完全也可以为自己量身定制一套CSS重设。




内容概要:本文研究了基于CNN-BiGRU-Attention混合神经网络模型的风电功率预测方法,旨在提升风力发电功率预测的准确性。该模型融合卷积神经网络(CNN)以提取输入变量中的局部时空特征,结合双向门控循环单元(BiGRU)充分捕捉时间序列前后向的长期依赖关系,并引入注意力机制(Attention)动态加权关键时间步的特征信息,增强模型对重要时刻的敏感度。研究采用多变量输入进行单步预测,综合纳入风速、风向、温度等多种气象因素作为模型输入,全面反映环境变量对风电输出的影响。通过Matlab平台完成模型构建、训练与仿真验证,实验结果表明该混合模型在预测精度与稳定性方面优于传统单一模型,有效提升了风电功率预测性能。; 适合人群:具备一定机器学习与深度学习理论基础,熟悉Matlab编程环境,从事新能源发电预测、电力系统调度、智能算法应用等相关领域的科研人员、工程技术人员及高校研究生。; 使用场景及目标:①应用于风电场实际运行中的短期功率预测,提高电网调度的安全性与可再生能源消纳效率;②为深度学习模型在复杂时序预测任务中的设计与优化提供实践范例,推动AI技术在能源系统智能化中的深度融合;③支持学术研究复现、课程项目设计与教学演示,帮助深入理解CNN、BiGRU与Attention机制的协同建模范式与实现细节。; 阅读建议:建议结合提供的Matlab代码进行动手实践,重点关注数据预处理流程、模型网络结构设计、超参数调优及训练收敛过程,鼓励尝试替换输入变量组合、调整网络层数或优化注意力结构,以进一步探究模型性能边界并提升预测鲁棒性。
内容概要:本文研究了基于Benders分解算法与输电网-配电网运营商(TSO-DSO)协调机制的双层优化模型,旨在有效应对新能源出力波动、负荷不确定性等对现代电力系统运行带来的挑战。模型上层由输电网运营商(TSO)负责全局资源优化与主网稳定性调控,下层由多个配电网运营商(DSO)实现本地分布式能源的灵活调度,通过Benders分解实现上下层之间的迭代协调与信息交互,从而在保障系统安全的前提下提升整体运行的经济性与鲁棒性。研究提供了完整的Matlab代码实现,涵盖数学建模、算法求解、收敛性分析及仿真结果可视化等环节,有助于深入理解双层优化架构在输配电网协同调度中的具体应用与技术细节。; 适合人群:具备电力系统分析、优化理论基础及一定Matlab编程能力的研究生、科研人员,以及从事电网调度、能源系统规划等相关领域的工程技术人员。; 使用场景及目标:①掌握Benders分解在电力系统双层优化问题中的建模与求解流程;②理解TSO-DSO协同机制下输配电网交互建模的核心思想与实现方法;③复现并拓展高水平学术论文中的优化模型,服务于科研项目攻关或实际工程仿真需求。; 阅读建议:建议结合凸优化理论、电力系统经济调度与Benders分解原理进行系统学习,优先运行并调试所提供的Matlab代码,调整关键参数以观察算法收敛行为与模型性能变化,从而深化对协调机制与优化机理的理解。
内容概要:本文档是一份关于经济学期刊论文复现的研究资料,聚焦核心议题“数字化转型能否促进企业的高质量发展”。文档构建了一个完整的量化分析框架,基于中国上市公司数据,实证探讨数字化转型对企业全要素生产率(TFP)及高质量发展的实际影响。内容涵盖数字化转型指标的构建、企业高质量发展评价体系的设计、计量经济模型的选择与应用(如固定效应模型、GMM方法),并提供Matlab代码实现全过程,包括数据处理、模型估计与稳健性检验。研究还系统梳理了OL、FE、LP、OP、GMM等多种全要素生产率的测算方法,为读者复现高水平经济学论文、深入理解数字经济时代的企业发展路径与政策含义提供了详尽的技术支持与理论指导。; 适合人群:具备扎实的经济学理论基础和较强的定量分析能力,熟悉Matlab或Python编程语言,正在从事经济管理、产业经济或数字经济等领域研究的研究生、高校教师及科研机构研究人员。; 使用场景及目标:①完整复现经济学顶刊论文的实证研究流程,掌握规范的学术研究范式;②学习并应用数字化转型与企业绩效间的因果识别策略,提升独立开展实证研究的能力;③为撰写学位论文、申报科研课题或编制政策咨询报告中涉及数字经济效应的章节提供直接的方法论参考和代码支持; 阅读建议:建议读者务必结合文档提供的数据与Matlab代码进行同步实操,重点钻研变量定义、模型设定、内生性处理和稳健性检验等关键环节,通过反复调试与验证,深刻领会高水平实证研究的严谨逻辑与技术细节,从而全面提升自身的科研素养与论文写作水平。
内容概要:本文围绕“绿电直连型电氢氨园区优化运行”开展创新性未发表研究,提出一种集成绿色电力直接供给、电解水制氢与合成氨工艺的多能耦合系统优化模型,旨在实现园区能源系统的低碳化、高效化与经济化运行。研究采用Matlab与Python编程语言,结合实际气象与负荷数据,构建涵盖电-氢-氨能量转换、存储与利用全过程的能量流、物质流及经济性协同优化框架,重点解决可再生能源出力波动导致的供需失衡问题,并通过优化电解槽、储氢罐、合成氨反应器等关键设备的运行策略与容量配置,提升系统对风光能源的就地消纳能力。文中配套提供完整的仿真代码、原始数据及Word格式论文,支持结果复现与模型拓展,具有较高的科研参考价值与工程应用潜力。; 适合人群:具备电力系统、能源工程、优化建模或新能源技术背景,从事综合能源系统、氢能利用、碳中和园区等相关领域研究的研发人员及硕士、博士研究生。; 使用场景及目标:①研究绿电直供模式下电-氢-氨多能系统协同运行机制与优化调度策略;②探索高比例可再生能源就地转化为高附加值化工产品的技术路径;③为工业园区实现深度脱碳与能源自洽提供决策支持;④作为学术论文撰写、课题申报或科研复现的高质量参考资料。; 阅读建议:建议结合Matlab与Python代码逐模块解析模型实现过程,重点关注目标函数构建、约束条件设定(如设备动态特性、能量平衡、安全边界)以及多场景仿真对比分析,宜在调试过程中调整权重系数与参数设置,深入理解系统灵敏度与优化机理,并尝试引入更多不确定性因素进行鲁棒性扩展。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值