Css 读完这篇文章后,我';我在考虑将eric meyer重置为全局重置,这是明智之举吗?

Css 读完这篇文章后,我';我在考虑将eric meyer重置为全局重置,这是明智之举吗?,css,Css,阅读后,我想将css重置从eric meyer重置更改为全局重置*{margin:0;padding:0} 或者只想这样使用 body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, legend, textarea, p, blockquote, th, td, a { border: 0 none; font-family: inherit; font-s

阅读后,我想将css重置从eric meyer重置更改为全局重置
*{margin:0;padding:0}

或者只想这样使用

body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6,
pre, code, form, fieldset, legend, textarea, p, blockquote,
th, td, a {
    border: 0 none;
    font-family: inherit;
    font-size: 100%;
    font-style: inherit;
    font-weight: inherit;
    text-decoration: none;
    vertical-align: baseline; }

table {
    border-collapse: collapse;
    border-spacing: 0; }

li { list-style: none; }

我不同意重置的“缺点”,并且说基本CSS重置实际上是好的,所谓的速度冲击实际上是不存在的,因为浏览器引擎足够快,可以执行继承级联-这就是为什么它们被称为级联样式表。

我不同意重置的“缺点”,说基本CSS重置实际上是好的,所谓的速度冲击实际上是不存在的,因为浏览器引擎的速度足够快,可以执行继承级联-这就是为什么它们被称为级联样式表。

我从许多聪明人那里听说,
*{margin:0;padding:0}
是处理器密集型的,因为它必须重置每个元素,尽管我从未见过任何测试。但是自从yahoo和eric meyer推荐了一个更全面的样式表之后,我一直在走这条路


保罗·奥布莱恩简要地讨论了我所说的。他还说,他从未见过加载时间有什么不同,我只是想提一下。

我从很多聪明人那里听说,
*{margin:0;padding:0}
是处理器密集型的,因为它必须重置每个元素,尽管我从未见过任何测试。但是自从yahoo和eric meyer推荐了一个更全面的样式表之后,我一直在走这条路


保罗·奥布莱恩简要地讨论了我所说的。他还说,他从未见过加载时间有什么不同,我只是想提一下。

全局重置会影响表单输入格式。如果你不使用表单,你可以不使用它。否则,选择性重置会产生更易于管理的结果


实际上,我已经扩展了Meyer的重置功能,使其能够强制块级HTML5元素正确设置样式:

全局重置会影响表单输入格式。如果你不使用表单,你可以不使用它。否则,选择性重置会产生更易于管理的结果


实际上,我已经扩展了Meyer的重置功能,使其能够强制块级HTML5元素进行适当的样式设置:

我使用了一个稍加修改的CSS重置版本,没有任何问题:

/* @group ntz css reset */

html, body, div, span, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, 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-size:100%;vertical-align:baseline;background:transparent}
body {line-height: 1}
ol, ul {list-style: none}
blockquote, q {quotes: none}
blockquote:before, blockquote:after,
q:before, q:after {content:'';content:none}

strong, b {font-weight:700}
em, i {font-style:italic}

ins {text-decoration:none}
del {text-decoration:line-through}
table {border-collapse:collapse;border-spacing:0}
caption, th, td {text-align:left;font-weight:100}

textarea {overflow:auto}
button {cursor:pointer;padding:0}
*:first-child+html button {width:1;overflow:visible}
* html button {width:1;overflow:visible}

input[type="checkbox"], input[type="radio"], input.radio, input.checkbox {vertical-align:text-top;width:13px;height:13px;padding:0;margin:0;position:relative;overflow:hidden;top:2px}

a {text-decoration:none; color:#4f81bd}
a:hover {text-decoration:underline}

:focus {outline:0}
a:focus {outline:1px dotted #999}

/*  -----------------------------------
    smart and dirty
--------------------------------------*/

.clearfix:after {content:".";display:block;height:0;clear:both;visibility:hidden}
.clearfix {display:inline-block}
/* Hide from IE Mac \*/
.clearfix {display:block}
/* End hide from IE Mac */
* html .clearfix {height:1px}

/* @end */

*{}
解决方案对于快速项目来说是一个很好的解决方案。对于更大的项目,您可能希望使用真正的重置,即使您在源代码中获得了一些额外的kb。您只需要在浏览器上保持一定的一致性…

我使用了一个稍微更改的CSS重置版本,没有任何问题:

/* @group ntz css reset */

html, body, div, span, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, 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-size:100%;vertical-align:baseline;background:transparent}
body {line-height: 1}
ol, ul {list-style: none}
blockquote, q {quotes: none}
blockquote:before, blockquote:after,
q:before, q:after {content:'';content:none}

strong, b {font-weight:700}
em, i {font-style:italic}

ins {text-decoration:none}
del {text-decoration:line-through}
table {border-collapse:collapse;border-spacing:0}
caption, th, td {text-align:left;font-weight:100}

textarea {overflow:auto}
button {cursor:pointer;padding:0}
*:first-child+html button {width:1;overflow:visible}
* html button {width:1;overflow:visible}

input[type="checkbox"], input[type="radio"], input.radio, input.checkbox {vertical-align:text-top;width:13px;height:13px;padding:0;margin:0;position:relative;overflow:hidden;top:2px}

a {text-decoration:none; color:#4f81bd}
a:hover {text-decoration:underline}

:focus {outline:0}
a:focus {outline:1px dotted #999}

/*  -----------------------------------
    smart and dirty
--------------------------------------*/

.clearfix:after {content:".";display:block;height:0;clear:both;visibility:hidden}
.clearfix {display:inline-block}
/* Hide from IE Mac \*/
.clearfix {display:block}
/* End hide from IE Mac */
* html .clearfix {height:1px}

/* @end */

*{}
解决方案对于快速项目来说是一个很好的解决方案。对于更大的项目,您可能希望使用真正的重置,即使您在源代码中获得了一些额外的kb。您只需要在浏览器上保持一定的一致性…

重置样式表的更合适方法是将它们作为主CSS的一部分,并根据每个项目对其进行修改

例如,许多重置样式表有以下行:

body{line-height:1;background-color:white;color:black}
但是,在这种情况下,您可能会在
主体上使用不同的
背景色
,因此您可以在自己的项目样式表中定义它

body{background-color:black;color:white}
通过将重置放在主样式表中,并将其视为“基础”而不是“重置”,可以用更适合项目的值替换重置值。然后,您还可以删除与您的项目无关的部分,例如,您可能永远不会在特定站点上使用表,那么为什么要包括对它们的重置呢?以下是我最近重新设计的工作网站的“基础”:

注意:这是针对我的工作现场的,可能不适合您自己的项目,请谨慎使用。

/* @group Base */
html,body,div,span,h1,h2,h3,p,a,ul,li,small,footer,header,hgroup,section{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}

  html,body{background-color:#fff;color:#000}
    body{line-height:1;font-size:87.5%;font-family:"ff-meta-serif-web-pro-1","ff-meta-serif-web-pro-2",Georgia,Times,'Times New Roman',serif;width:890px;margin:0 auto;position:relative}

  /* @group Text Formatting */
    p{margin-bottom:5px;font-size:1em;line-height:1.4em}
  /* @end */

  /* @group Links */
    a{color:#B11C2D;text-decoration:none;-webkit-transition:color 0.3s linear}
    a:visited{color:#6d2831}
    a:hover,a:focus{color:#000}
  /* @end */

  /* @group Lists */
    ul{list-style:disc outside none;margin:1em 1.5em}
  /* @end */
/* @end */
我删掉了我不需要的内容,并用我需要的作为基础的内容替换重置值,以确保以后不会覆盖基础。这位于my screen.css文件的顶部,后面是不属于基础的样式(例如
的定位)


最后,重置样式表不是一成不变的。您可以根据自己的感觉对其进行编辑,以便为您的web项目创建更合适的基础。如果您想保留键盘导航链接上的“大纲”,请编辑重置以允许此操作。创建您自己的基础CSS,然后在每个项目上根据需要重新调整其用途。

重置样式表的更合适方法是将其作为主CSS的一部分,并根据每个项目对其进行修改

例如,许多重置样式表有以下行:

body{line-height:1;background-color:white;color:black}
但是,在这种情况下,您可能会在
主体上使用不同的
背景色
,因此您可以在自己的项目样式表中定义它

body{background-color:black;color:white}
通过将重置放在主样式表中,并将其视为“基础”而不是“重置”,可以用更适合项目的值替换重置值。然后,您还可以删除与您的项目无关的部分,例如,您可能永远不会在特定站点上使用表,那么为什么要包括对它们的重置呢?以下是我最近重新设计的工作网站的“基础”:

注意:这是针对我的工作现场的,可能不适合您自己的项目,请谨慎使用。

/* @group Base */
html,body,div,span,h1,h2,h3,p,a,ul,li,small,footer,header,hgroup,section{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}

  html,body{background-color:#fff;color:#000}
    body{line-height:1;font-size:87.5%;font-family:"ff-meta-serif-web-pro-1","ff-meta-serif-web-pro-2",Georgia,Times,'Times New Roman',serif;width:890px;margin:0 auto;position:relative}

  /* @group Text Formatting */
    p{margin-bottom:5px;font-size:1em;line-height:1.4em}
  /* @end */

  /* @group Links */
    a{color:#B11C2D;text-decoration:none;-webkit-transition:color 0.3s linear}
    a:visited{color:#6d2831}
    a:hover,a:focus{color:#000}
  /* @end */

  /* @group Lists */
    ul{list-style:disc outside none;margin:1em 1.5em}
  /* @end */
/* @end */
我删掉了我不需要的内容,并用我需要的作为基础的内容替换重置值,以确保以后不会覆盖基础。这位于my screen.css文件的顶部,后面是不属于基础的样式(例如
的定位)

最后,重置样式表不是一成不变的。您可以根据自己的感觉对其进行编辑,以便为您的web项目创建更合适的基础。如果您想保留键盘导航链接上的“大纲”,请编辑重置以允许此操作。创建自己的基本CSS,然后将其重新调整为appro