Don't Reset – Soft Reset
Summary
Soft Reset (for the lack of a good name) is very similar to many of the already popular resets like Meyer Reset or YUI Reset in that the goal it to level the playing field for web developers. What makes this reset different is that it attempts to hone in and reset only the properties that really need to be reset. Leaving some styling to the browser.
My reason for creating this reset is that I wanted a reset that was not overly bloated with unnecessary resets for html properties that I simply didn't use in my layouts. I also didn't think it's necessary to reset every property on the page when sometimes a simple localized class would be sufficient. For example: some sites may only need the main navigation and sub navigation to be reset. Why reset everything only to build it back up for the main content area?
Goals
- Reset common html elements while leaving some items alone
- Slim down the reset by omitting HTML 5 specific elements
- Reduce the need to build up elements when the browser default is acceptable
- Add a reusable class to deal with list that need to be reset
reset.css
/* Soft Reset */
body, div, dl, dt, dd, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, legend, input, textarea, p, blockquote, th, td { margin:0; padding:0; }
table { border-collapse:collapse; border-spacing:0; }
fieldset, img { border:0; }
h1, h2, h3, h4, h5, h6, address, caption { font-style:normal; font-size:100%; font-weight:normal; }
caption, th { text-align:left; }
ol.listreset, .listreset ol, ul.listreset, .listreset ul, .listreset li { margin:0; padding:0; list-style:none; }
Usage
For the most part SoftReset works exactly the same as other resets. The biggest difference is that I abstracted the ordered and unordered list resets into a separate class. Simply apply the class to any list that you need to reset like a navigation for example. Here is an example of how I would use it.
<ul class="navigation listreset">
<li><a href="">Home</a></li>
<li><a href="">Blog</a></li>
</ul>
Why Create The .listreset Class?
Reusing classes are performance freebies. If you follow the concepts around Object Oriented CSS (OOCSS) you will already know that abstracting these bits of code can greatly improve your application performance. Where as performing a full reset, to build it up again is a big performance drain. If your using a css framework, chances are, your breaking down and rebuilding lists so often, that this single class can save you hundreds of lines of code on a larger site.
Samples And Testing
The YUI 2 reset already had a very comprehensive HTML test page. I ran my reset against it to see how it did. I also created my own HTML test page with many of the same elements with a few additional ones.
NOTE: Use Firebug to turn the reset off and on.
YUI HTML Test Page | My Test Page
Feedback
Since this is just something I am dabbling with, I would appreciate your feedback on this. Maybe it's a good idea? Maybe It's a stupid idea? I urge you to download a copy of the soft reset css and try it out for yourself. See if it works for you. If you have suggestions for improvements I would like to here them in the comments bellow.
7 comments so far ↓
A good idea is to customize the reset based on the tags that you will use on the website (specially if it's for mobile devices) - Eric Meyer's and YUI Reset are way too big.
Cheers.
It's a project, and school takes up too much of my time :-(
Leave a Comment