I was going to use Eric Meyer CSS reset, but I came across some differences between browsers (e.g. input fields). Based on this, I came up with a more aggressive approach:
(This is deprecated. Remember to check the current revision at the end of this question and criticize it as you see fit)
* { margin: 0; padding: 0; border: 0; outline: 0; font: inherit; text-decoration: none; font-family: "times new roman"; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; } :before, :after { content: ''; } :link, :visited, :hover, :active { color: inherit; color: #000; text-decoration: none; } :focus { outline: 0; } ol li, ul li { list-style: none; } table { border-collapse: collapse; border-spacing: 0; } article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section { display: block; }
It worked smoothly in all tested browsers:
- IE7
- IE8
- Chrome (newest)
- Firefox (newest)
- Opera (newest)
Question: Does anyone see a problem here? I consider myself not very good in CSS, so I don’t know if this will affect me in the future.
Designation: this reset is for cross-browser issues only. It should (or should!) Be followed by general rules for elements such as input , a , code , etc. (For example: input type "text" will be invisible without borders!). I will add things like general styles a and stuff later. At the moment, I am reloading things, getting rid of (almost) everything that is not the same in the main browsers.
PROBLEMS DEDICATED TO SO FAR
The selector * can cause performance problems.
The selector * with some rules overrides some default element styles in such a way that they cannot be restored. ex: default input style of type submit.
It's amazing that :before, :after { content: ''; } :before, :after { content: ''; } crashed select elements in Firefox.
In the revised version, I tried to set margin: 0 to all input elements. Most browsers ignored it for input like checkbox and radio .
REVISED VERSION
a, abbr, acronym, address, b, big, blockquote, body, br, caption, cite, code, col, colgroup, dd, del, dfn, div, dl, dt, em, fieldset, form, h1, h2, h3, h4, h5, h6, hr, html, i, img, ins, kbd, label, legend, li, noscript, object, ol, p, pre, q, samp, small, span, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, ul, var { margin: 0; padding: 0; border: 0; outline: 0; font: inherit; text-decoration: none; font-family: "times new roman"; font-size: 100%; font-style: normal; font-variant: normal; font-weight: normal; } button, select, textarea, input[type=text], input[type=password], input[type=submit], input[type=image], input[type=reset], input[type=button], input[type=file] { margin: 0; } :link, :visited, :hover, :active { color: inherit; color: #000; text-decoration: none; } :focus { outline: 0; } ol li, ul li { list-style: none; } table { border-collapse: collapse; border-spacing: 0; } blockquote:before, blockquote:after, q:before, q:after { content: ''; } article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section { display: block; }
End
Well, the more I tried to improve my reset, the more it looked like meyer css reset , so I gave mine and accepted it. works fine: p