User Agent Style Sheets: Basics and Samples

Published on September 22, 2007 (↻ April 15, 2024), filed under (RSS feed for all categories).

This and many other posts are also available as a pretty, well-behaved ebook: On Web Development.

CSS manages the default formatting of documents through the concept of user agent style sheets, a cornerstone of the cascade. This means that a web browser doesn’t just present a line of text when it’s fed with an HTML document that has no styling information, but instead serves it using minimal formatting.

Unstyled HTML document.

Figure: HTML document with Firefox default styling.


CSS 1 introduces the idea by stating that “each User Agent (UA, often a ‘web browser’ or ‘web client’) will have a default style sheet that presents documents in a reasonable—but arguably mundane—manner.” CSS 2 says that “conforming user agents must apply a default style sheet (or behave as if they did)” and that “a user agent’s default style sheet should present the elements of the document language in ways that satisfy general presentation expectations for the document language.” CSS 3 is of the same mind.

Since the CSS specifications leave it up to implementations whether to use a “real” style sheet for default display or not, it’s not surprising that you don’t find a default style sheet in every browser’s installation folder. Unlike Microsoft’s Internet Explorer as well as Opera, however, Gecko browsers like Firefox and Netscape Navigator (“html.css”) but also Konqueror make it rather simple to comprehend their default styles.

User Agent Style Sheets

The following is a [maintained] list of default style sheets I’ve compiled over recent years. Due to the fact that Firebird, Firefox, and Co. are all based on the same layout engine, their style sheets are similar, if not identical.

For comparison, note a 1998 “base style sheet,” as well as the default style sheets proposed by the W3C in the specifications of CSS 1, CSS 2, CSS 2.1, and CSS 2.2:

User Agent and Reset Style Sheets

The examples aim to provide some insight into user agent style sheets. Knowledge of user agent style sheets should help get a better understanding of CSS as well as any display “phenomena.”

However, I encourage to use this knowledge for other things than building more or larger “reset” style sheets. Assuming use of additional style sheets other than just a reset, reset style sheets are typically unnecessary. From my experience, the only occasionally helpful and then quite memorable reset is * { margin: 0; padding: 0; }. Reset style sheets are going to be handled in other posts though, revealing why they’re, well, bad. [Still in doubt? Try this sanity check: Use your preferred reset, then temporarily remove it and see what happens.]

Was this useful or interesting? Share (toot) this post, or maybe treat me to a coffee. Thanks!

About Me

Jens Oliver Meiert, on September 30, 2021.

I’m Jens, and I’m an engineering lead and author. I’ve worked as a technical lead for companies like Google and as an engineering manager for companies like Miro, I’m close to W3C and WHATWG, and I write and review books for O’Reilly and Frontend Dogma.

With my current move to Spain, I’m open to a new remote frontend leadership position. Feel free to review and refer my CV or LinkedIn profile.

I love trying things, not only in web development, but also in other areas like philosophy. Here on I share some of my views and experiences.

Comments (Closed)

  1. On September 22, 2007, 12:15 CEST, Alen said:

    Thanks for sharing this. You said it well, it gives us better understanding of css and how/what to do with our own style sheets.

  2. On September 24, 2007, 8:37 CEST, Martin Hassman said:

    For Safari/Webkit stylesheets cannot be found in the installation (propably compiled into some library), but they are on the web source tracking system with their history


  3. On September 24, 2007, 11:18 CEST, Jens Oliver Meiert said:

    Thanks Martin—I updated the post!

  4. On September 25, 2007, 16:29 CEST, Barney said:

    This is a very nice piece, Jens. I’m glad someone can give this little study authoritatively because the recent craze over reset stylesheets, and inherently the notion that browser defaults are bad, is often very misguided: If you are going to respecify everything, there is no need for the extra rule for every element; if you aren’t, you’re far better off with the user/developer’s consideration than nothing.

  5. On September 26, 2007, 9:54 CEST, Daniel said:

    I absolutely don’t agree with you. The reset with * {margin: 0; padding: 0; } is the worst method of resetting the browser’s default styles.
    Especially when working on form elements it make a lot of problems.

    The better reset: Reset Reloaded

    Kind regards

  6. On November 12, 2007, 19:50 CET, Lynne said:

    Interesting read… I just assumed that if the link to the CSS was broken the browsers would default to plain HTML formatting. However, it certainly makes more sense to have a default css file.

  7. On December 30, 2007, 23:34 CET, Lazar said:

    Thanks for this. It’s really useful info! Especially for CSS beginners like me.

  8. On January 7, 2008, 15:53 CET, Anders said:

    Interesting read, but I am not able to find out where a textarea’s default font (courier) comes from. Anybody?

  9. On February 14, 2008, 22:22 CET, ty said:

    Thanks for an excellent writeup.
    So what do you start with as a default then?
    I’ve been using a reset of sorts, and am finding some of those defining things I never use in my markup, so that seems redundant to me.
    How to be sure borders, margins don’t create problems without resetting them or defining them to be the same despite whatever UA styling could derail a layout?

  10. On April 28, 2011, 20:37 CEST, John Lascurettes said:

    I would love to know how to pry into IE’s resource files to view the actual UA CSS the way I can with Gecko and Webkit. Does anyone have a guide on how to do that? The googles has failed me.