Default Styles for HTML Elements

You want to style your Web pages with CSS, and you know exactly what style declarations each element should have, but still are worried. What are the browsers' default styles for the elements you're using?

For example, let's say you want to use the <dfn>...</dfn> element for the defining instance of a word (e.g., A <dfn>computer monitor</dfn> is someone who watches computers). And you want to style every <dfn> using the rule dfn{background-color:#ffccff}. But what if some browser makes every <dfn> italic (dfn{font-style:italic}) automatically? Then you need to specify that your <dfn> elements should not be italicized; that is, you need to include dfn{background-color:#ffccff;font-style:normal} in your style sheet. But that's true for every element, not just <dfn>! So you either need to specify every possible property for every single element you use (which would make quite a large style sheet), or you need to know what browsers' default styles are, that you can countermand them.

That's what this page is for: It'll tell you which CSS2 properties browsers set, by default, for various HTML4 elements. Now, it won't tell you every property attached to every element -- some you can figure out yourself. For example, you can figure out for yourself that <body> will always have font and color (among many others) defined, and that <p> will have padding (among others) defined; that much is obvious. I will only point out the ones which might not be so obvious. And even among those, I may well miss some, as I haven't certainly haven't used every browser. Anyway, here goes:

ElementDefault properties
:active, :focus outline
a, a:link, a:visited, a:active, a:focus, a:hover color, cursor, text-decoration
abbr, acronym border-bottom, font-variant, letter-spacing
address font-style, margin-left
blockquote font-style, margin-left, margin-right
blockquote:after, blockquote:before content
caption font-size, font-style, font-weight, text-align
cite font-style
code font-family, font-size
dd margin-left
del text-decoration
dfn font-style
em font-style
h1, h2, h3, h4, h5, h6 font-size, font-style, font-weight, line-height, margin, text-align
img, a img border
ins text-decoration
kbd font-family, font-size
ol, ul, li margin-left
pre font-family, font-size
q:after, q:before content
samp font-family, font-size
strong font-weight
sub, sup font-size
th font-size, font-style, font-weight, text-align
tt font-size
var font-style
HTML tutorial.
Homepage.
Brief comment on this page: Or: .