Why is there the need for browser resets?

给你一囗甜甜゛ 提交于 2019-12-10 18:14:00

问题


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?


回答1:


Because certain rules make sense by default:

  • Table cells have display:table-cell;
  • <b> makes text bold, <i> makes text italic
  • Paragraphs should have space in between them
  • Unordered lists should be displayed as bulleted lists

The problem isn't that browsers have defaults, it's that the defaults are all different.




回答2:


Off the top of my head - to do something reasonable when displaying plain html, not styled sites.




回答3:


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.




回答4:


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.




回答5:


It is because it gets you into a known state and therefore will look similar across a variety of browsers.




回答6:


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/



来源:https://stackoverflow.com/questions/2895188/why-is-there-the-need-for-browser-resets

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!