

The line above will ensure that all browsers are now using the same margin and padding on ordered lists. It’s only when you don’t explicitly set the style that the default will be used.įor example when I’m using an unordered list on a site, I’ll add the following to the css If you explicitly set a margin-bottom of 20px on tags then all browsers will use that 20px. Since it’s the browser defaults causing the problem, don’t let the browser default be the style that’s applied. The solution to the problem above is actually quite simple. There are many other inconsistencies and if you aren’t aware of each it can be confusing to try to make your design work cross browser. When you come along and change one or the other things are no longer equivalent across browsers.

By default lists are usually indented, however one browser will do that by giving the list some margin and another does it by giving the list some padding.

Here’s a more recent table of defaults for IE6–IE9 Browserīrowsers typically use 16px as the default font-size for body text so 2em = 32px = 12pt, but it’s easy to realize how different these values will be if you change the font-size on the body or start setting the size for the tag.Īnother common example of different browser defaults are lists.
Simple css reset full#
The date listed in the url shows the full table is nearly 2 years old, but there’s no reason to think the default values have changed. The values are from a more complete table of CSS2.1 User Agent Style Sheet Defaults. The table below shows defaults for an tag in several browsers. While browsers with the same rendering engine will use the same defaults, two different rendering engines could have different default values. The problem is there isn’t a standard for what those defaults should be. By default all these things will look different. An should look different from an, which should look different from a, etc. This is a good thing and one of the reasons html is relatively easy to use. It will likely be larger than other text on the page, it will be bold, and it will have a certain amount of space above and below. When you add an to a web page, but don’t specifically style it in any way, that will by default have some styles associated with it. I want to talk about the problem of different presentational defaults used by browsers, and then talk about how css resets solve the problem and why you may not want to use a css reset. The fact that different browsers and different versions of browsers look at these and other variables differently is a really pain.Īll true except for that last part about it being a pain to develop cross-browser css. One issue is that different browsers have different definitions of the padding and the margin variables. However css resets have some cons along with the pros. Fortunately there’s an easy solution, which is to use a css reset file. A recent comment by Chris on my post about css vs tables, reminded me that developing cross-browser css still gives people trouble.
