Jens Oliver Meiert

User Agent Style Sheets: Basics and Samples

Published on Sep 22, 2007 (updated Apr 16, 2025), filed under (feed). (Share this on Mastodon or Bluesky?)

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.

Specification

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.]

Many thanks to Martin Hassman and GermĂĄn FreixinĂłs LĂłpez for their help to improve this collection!

About Me

Jens Oliver Meiert, on November 9, 2024.

I’m Jens (long: Jens Oliver Meiert), and I’m a web developer, manager, and author. I’ve worked as a technical lead and engineering manager for small and large enterprises, I’m an occasional contributor to web standards (like HTML, CSS, WCAG), and I write and review books for O’Reilly and Frontend Dogma.

I love trying things, not only in web development and engineering management, but also in other areas like philosophy. Here on meiert.com I share some of my experiences and views. (I value you being critical, interpreting charitably, and giving feedback.)