您使用哪种 HTML5 重置 CSS,为什么?您是否发现有一个可以涵盖更多案例?
我已经开始使用 HTML5 Doctor's:http ://html5doctor.com/html-5-reset-stylesheet/它似乎有效,但我想知道那里是否有更好的东西。
实事求是:尽管降价kaikai是对的,但您只需要将 *padding & margin 重置为 0。
尽管不幸的是,我们 99% 的人都没有资源或人力来跟上数百个浏览器版本的步伐。因此,对于典型的网站来说,重置表是必不可少的。
html5reset:(太干扰了)
我只是看了一下http://html5reset.org/
img,
object,
embed {max-width: 100%;}
和:
html {overflow-y: scroll;}
我知道它有良好的意图,但这不是重置表的工作。它做了太多的假设。
蓝图重置:(字面意思是蓝图)
body {
line-height: 1.5;
background: white;
}
1.5怎么了。为什么背景是白色的?(我知道这是为了纠正但仍然没有必要)
Normalize.css:(不正常)
https://github.com/necolas/normalize.css/blob/master/normalize.css
它从一些 webkit/ie hacks 开始很好,但是
h1 {
font-size: 2em;
margin: 0.67em 0;
}
h2 {
font-size: 1.5em;
margin: 0.83em 0;
}
h3 {
font-size: 1.17em;
margin: 1em 0;
}
h4 {
font-size: 1em;
margin: 1.33em 0;
}
h5 {
font-size: 0.83em;
margin: 1.67em 0;
}
h6 {
font-size: 0.75em;
margin: 2.33em 0;
}
每个标题标签都是目标。&他们不会重置身体的线高。
我确信以上所有内容都可以很好地完成预期的工作,但可能会被过度覆盖。
埃里克·迈耶
小唯
HTML5样板
以上内容更适用于 Boilerplate 倾向于(过于友好)方面的专业人士,我敢肯定,由于受欢迎程度。目前,我的自定义重置中有 80% 是样板文件。
我将一点一点地完成所有这三个并制作我自己的,这不是火箭科学。
Normalize.css非常适合桌面和移动浏览器,并用于许多流行的 HTML 模板。
但是如何使用all
重置 CSS 属性的 CSS 属性,除了direction
和unicode-bidi
?这样您就不需要包含任何其他文件:
{
all: unset
}
Blueprint CSS框架使用的reset.css运行良好,并且包含 HTML5 元素。它包含在他们的screen.css文件中。
蓝图是新网站快速原型设计的有用资源,其源代码组织良好,值得学习。
Eric Meyer 还发布了他的 CSS 重置 v2(他在差不多一年前就这样做了):
* {
margin: 0;
padding: 0;
}
简单但完全有效。也许扔一个:
body {
font-size: small;
}
为了很好的衡量。
The HTML5 spec includes recommended CSS declarations for CSS-capable browsers. For the fun of it I took them and reverted those, where it makes sense. You can view the result in this article.
However, I don't recommend using this in production. It's more a proof of concept and might better be used to give hints than to serve as an all-purpose-reset stylesheet. Any of the other suggestions before might be a better choice.
我使用 Normalize 或来自 HTML5 Doctor 的重置,并更改它以适应我正在处理的项目。
顺便说一句,这只是使用重置的概念,这或多或少已成为标准。