Which HTML5 reset CSS do you use and why? [closed]

…衆ロ難τιáo~ 提交于 2019-11-26 06:56:52

问题


Which HTML5 reset CSS do you use and why? Is there one that you\'ve found to cover more cases?

I\'ve started using HTML5 Doctor\'s: http://html5doctor.com/html-5-reset-stylesheet/ It seems to work, but I\'m wondering if there is something better out there.


回答1:


Real talk: Despite the markdowns kaikai is right, you only need to reset *padding & margin to 0.

Though unfortunately 99% of us do not have resources or man power to keep up with the hundreds of browser versions out there. So a reset sheet is essential for the typical website.

html5reset: (It's too interfering)

I just took a look at http://html5reset.org/

img,
object,
embed {max-width: 100%;}

And:

html {overflow-y: scroll;}

I understand it has good intentions but, that's not the job of a reset sheet. It's making too many assumptions.

BluePrint Reset:(literally a blueprint)

body {
  line-height: 1.5;
  background: white;
}

Whats up with 1.5. And why background white?(I know it's for correcting but still not necessary)

Normalize.css: (Not normal)

https://github.com/necolas/normalize.css/blob/master/normalize.css

It started good with some webkit/ie hacks but

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

Every header tag is targeted. & they don't reset the line-height of the body.

I'm sure all the above does the intended job well, but will probably be overridden more than necessary.

Eric Meyer

YUI

HTML5Boilerplate

The above are more for pros with Boilerplate leaning to the (over friendly) side I'm sure due to popularity. At the moment 80% of my customized reset is boilerplate.

I'm going to go though all three bit by bit and make my own, it's not rocket science.




回答2:


Normalize.css is great for both desktop and mobile browsers and is used in many popular HTML templates.

But what about using the CSS all property which resets CSS properties except direction and unicode-bidi? That way you don't need to include any additional files:

{
    all: unset
}

CSS all has wide support except in IE/Edge. Similarly with unset.




回答3:


The reset.css used by Blueprint CSS framework works well and includes HTML5 elements. It gets included in their screen.css file.

Blueprint is a useful resource for rapid prototyping of new sites, and their source code is well organized and worth learning from.




回答4:


Eric Meyer also released v2 of his CSS reset (and he did so almost a year ago now):

http://meyerweb.com/eric/tools/css/reset/




回答5:


  1. Preserves useful defaults, unlike many CSS resets.
  2. Normalizes styles for a wide range of HTML elements.
  3. Corrects bugs and common browser inconsistencies.
  4. Improves usability with subtle improvements.
  5. Explains what code does using detailed comments.

normalize.css




回答6:


* {
    margin: 0;
    padding: 0;
}

simple yet entirely effective. perhaps throw in a:

body {
    font-size: small;
}

for good measure.




回答7:


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.




回答8:


I use Normalize or the reset from HTML5 Doctor, and I alter it to fit the project I'm working on.

BTW it's only the concept of using a reset that's become more or less a standard.



来源:https://stackoverflow.com/questions/3485720/which-html5-reset-css-do-you-use-and-why

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