Forum Moderators: not2easy

Message Too Old, No Replies

Default Values and Browers

A list of default css values and the browsers that follow it (or don't)?

         

snair

10:39 pm on Jul 10, 2006 (gmt 0)

10+ Year Member



Does anyone know of a comprehensive list of default css values (e.g. by default most headers are [font-weight:bold], etc.) and if the different browsers follow it? (I know the W3C has that info on it, but it's very spread out, and it also doesn't list if certain browsers follow it or not.).

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

Setek

6:19 am on Jul 11, 2006 (gmt 0)

10+ Year Member



As far as I've tested, the initial values of
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 :)

SuzyUK

8:06 am on Jul 11, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



A sample style sheet for HTML 4.0 [w3.org]

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

netchicken1

8:15 am on Jul 11, 2006 (gmt 0)

10+ Year Member



Ta Da!

[w3schools.com...]

I hope this is what youa re after...

penders

12:27 pm on Jul 11, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



netchicken1 - Your w3schools link, although very useful, lists all the CSS properties and which browsers support them, rather than the actual default values for those properties for each browser. I think Suzy's link to the W3C property definitions is about as close as.

snair

9:48 pm on Jul 11, 2006 (gmt 0)

10+ Year Member



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.

Ah...thanks for that!

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! :)

encyclo

1:20 am on Jul 12, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



If you want a specific, comprehensive, default stylesheet, then you should check out the default CSS file for Firefox or Mozilla.

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.