Possible Duplicate:
Browsers' default CSS for HTML elements
Is there a reference somewhere of all the default styles of DOM elements?
For example, how big the margin above an <h1> is?
Is there some easy way to extract this? I tried:
document.getElementById("myheading").style.marginTop
But it returned blank. Presumably because nothing had been defined for marginTop?
Thanks in advance.
You have a few options. The specs have a loosely defined list. HTML4 and HTML5
If you wish to actually see the computed style, you can use a program like Firebug, Chrome Developer Tools, IE Developer Tools, or Opera Dragonfly.
If you need to programmatically get the computed style, I recommend that you use jquery to even out the differences, or use the getComputedStyle() or currentStyle attributes of an element. jQuery does this for you automatically.
If you just want to know how to handle this cross-browser without going insane, I recommend using a Reset Stylesheet. There are many. Eric Meyer’s is the most famous, but nowadays there are many tools, like Bootstrap, Blueprint, Normalize, and YUI.