Forum Moderators: not2easy
Also, I'm curious how other's deal with default values?
For example, most of us probably don't do [font-weight:normal] on stuff, but when you use [position:absolute] and you just want it on the top, left (the default), do many of you still declare [top:0; left:0]? Or in the case of headers, do you still declare [font-weight:bold]?
h1 - h6, p, blockquote and ul's were all fairly... dissimilar. I tested between IE 6 and Firefox 1.5.0.4 (both on Windows.)
The best way to manage this, using the universal selector (
*) to reset the margin and padding from all elements. Then set them yourself, and you have better control :)
the above seems to be the broad outline for basic browser default styles, but it's only a sample guideline and the different browsers do please themselves a bit!
As Setek said the biggest x-browser discrepancies seem to be with margin and padding on elements. Handling of lists differs quite a lot. Some browsers use the padding to create the indent, some use the margin therefore agreeing with the above it's a lot better to reset all elements margin/padding to zero then create your own, that way your suggestion is pretty much uniform to all browsers ~ same with default font-sizes too.
There isn't a complete list of which browser does what, that I know of anyway, so short of going through all browsers stylesheets, it's enough to know that there are differences and if you want to be sure, take control and don't rely on the defaults ;)
having said that, re: font-weight bold on the headers, I wouldn't normally re-declare that as habit because that is pretty much uniform x-browser..
your positioning question is different, you're no longer talking about the browser default for a particular element you're now onto the default values for specific CSS properties, this is where you have to go to the CSS property definitions [w3.org] to find out the defaults for them. They can be relied on in the main.
with your "top" [w3.org] positioning you can see that "auto" is actually the default ~ so yes in that scenario, top left corner, I would declare top: 0; left: 0; as it's not necessarily the same thing and IE can have a bit of problems with the "auto" keyword/box model at times.
Suzy
The best way to manage this, using the universal selector (*) to reset the margin and padding from all elements.
Yeah, I just recently started doing that and it has been a lifesaver!
http://www.w3schools.com/css/css_reference.asp
That's a nice reference to have too!
A sample style sheet for HTML 4.0
the above seems to be the broad outline for basic browser default styles, but it's only a sample guideline and the different browsers do please themselves a bit!
Wow, I can't believe I missed that! Thanks!
your positioning question is different, you're no longer talking about the browser default for a particular element you're now onto the default values for specific CSS properties, this is where you have to go to the CSS property definitions to find out the defaults for them. They can be relied on in the main.
I'm all for competition, because I do think it makes products better...but sometimes I really wish there was just one browser! And I don't care which browser it is, I just want 1! :)
Assuming you have Firefox installed, you should search for hard drive for a file called simply "html.css" which will probably be in you "Program Files\Firefox" directory (sorry, I'm running Linux so I can't give you the exact path.)
All default styles in Firefox are defined with this CSS file, so it is a great starting point.