为什么需要重置浏览器?
好吧,这可能不是最好的标题,我知道为什么我们需要浏览器重置:因为浏览器设置了不同的默认值。
我的问题太长了,无法放入标题中:
如果每个人 90% 的时间都需要使用重置样式表,为什么浏览器需要设置默认样式?无论如何我们都会删除它们,对吗?
Okay that's probably not the best title, I know why we need browser resets: because browsers have different defaults set.
My question that was too long to put into a title is:
If everyone needs to use a reset stylesheet 90% of the time, why do browsers need to set default styles? We're just going to remove them anyways, right?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(6)
因为默认情况下某些规则是有意义的:
display:table-cell;
使文本变为粗体,
使文本斜体
问题不在于浏览器有默认值,而在于默认值都不同。
Because certain rules make sense by default:
display:table-cell;
<b>
makes text bold,<i>
makes text italicThe problem isn't that browsers have defaults, it's that the defaults are all different.
在我的脑海中——在显示纯 html 而不是样式化网站时做一些合理的事情。
Off the top of my head - to do something reasonable when displaying plain html, not styled sites.
因为并不是每个人都使用“重置样式表”。我想到的最大的例子是维基百科,它以浏览器的默认字体显示内容。
Because not everyone uses a "reset stylesheet". The biggest example off the top of my head is Wikipedia, which displays content in the browser's default font.
在我看来,重置样式表仅对那些对浏览器之间的细微样式差异大喊大叫并且不了解默认行为/样式的初学者有用,因此他们被迫将所有这些样式填充到 CSS 中。
如果您想了解这个固执己见的答案背后的更多想法,请检查 这个答案。
The reset stylesheets are in my humble opinion only useful for starters who are ranting on the minor styling differences among browsers and doesn't know the default behaviours/styles from top of head so that they're forced to fill all of those styles in the CSS themselves.
If you want to see more thoughts behind this opinionated answer, check this answer.
这是因为它让您进入已知状态,因此在各种浏览器中看起来都很相似。
It is because it gets you into a known state and therefore will look similar across a variety of browsers.
基本上,这是一种在应用 CSS 之前通过克服任何基于浏览器的规则和遗漏来保持结果尽可能通用的方法。 http://www.css-reset.com/
请参阅本页上的演示 http://www.maxdesign.com.au/articles/css-reset/
basically, it's a way to keep results as universal as possible by defeating any browser-based rules and omissions before your CSS is applied. http://www.css-reset.com/
See presentation on this page http://www.maxdesign.com.au/articles/css-reset/