Efficacy of combinging reset and base, instead of building one off the other

浪子不回头ぞ 提交于 2019-12-10 21:23:33

问题


Recently I've taken to combining reset and base into one nefarious optimized streamlined smorgasbord. I'm finding it to be a real treat, and wonder if this is common practice. My guess is "no"...and "yes"...

That is, I'm under the impression that some programmers get annoyed with reset and like to do everything from scratch. Others like the convenience of a baseline, but they do it first with a reset.css stylesheet, followed with a stylized base.css

My new approach has them combined. One crude extracted example might illustrate.

Previous reset:

h1,h2,h3,h4,h5,h6{margin:0;padding:0;font-size:100%;font-weight:normal;}

Previous base:

h1{font:bold 12px/16px "FancyAtFaceFont",Georgia,serif;margin:0 0 12px;}

But see the doubling up there of font and margin styles? Am I totally way too nitpicky a developer for thinking of rather doubling them up into something like this:

h1{font:bold 12px/16px "FancyAtFaceFont",Georgia,serif;margin:0 0 12px;padding:0;}

There's effectively no need for the former reset, in this case, in other words. With the exception of the padding, everything was already being overridden. This technique streamlines everything. The only thing to watch for is to make sure that you refine each html tag for every site one does. But I find I do this work anyway.

What say ye?


回答1:


Your technique is actually preferred by many people. I tend not to use resets anymore because, like you, I find that defining some good base styles is more efficient and easier to manage.

Johnathan Snook agrees: http://snook.ca/archives/html_and_css/no_css_reset/ and he would be a pretty good authority on the matter if you're looking for a well known web professional who agrees.



来源:https://stackoverflow.com/questions/4393037/efficacy-of-combinging-reset-and-base-instead-of-building-one-off-the-other

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