MEM wrote: > Hello again, > > Gunlaug Sørtun Wrote: >> "General advice: declare 'font-size: 100%; line-height: 1.4;' on >> body" > > Done. I have made line-height to 1.4 and I believe its a nice value > since 1(e.g) is too hard for reading proposes. I've also put the > font-size: 100% but, here, I don't understand why. :s > > If we will use, for example, .10em to downsize a text and 3em to > upsize, or we will use 50% to downsize or 200% do upsize, why do we > need the establish a default value of 100% on the top of our css > files? I mean, I believe we state a value on the top of our css file > for two main reasons: "reset browser default values, and make them > the startup point for all other dimensions that will be relatives to > this top declared values, (is this correct?).
First: to talk about "reset" is wrong. No values anywhere are resetting anything, as there isn't anything to "reset" too but browsers defaults and browsers know those perfectly well already. We declare our intentions - "set" our chosen values, and sometimes it simply makes sense to confirm browsers own defaults for a property. Regardless of what you may have heard or read anywhere; browsers come with some pretty reasonable defaults, that one should have quite good reasons to override - especially default-values that they all seem to agree on like the one for font-size. Line-height defaults differ slightly, so it often makes sense to level them with a mid-range value that makes reading easy, and that helps with styling of other in-text elements we may use. > However, I do understand this approach in pixel point of view, but I > don't understand this approach in % point of view. I mean, if we > state on the top of our browser: "Dear Browser, please take in > consideration that 5px is now your default dimensions for text". > Then, when we will declare later on, a <p> tag with a text size of > 50%, the browser should know that he/she needs to present a 2.5px > text. It does, but depending on how browsers options are set they may not render anything that small - no matter how nicely you formulate yourself :-) > But if we declare 100% at the top, what does the browser know about > the relative values? Browsers know that _all_ font-size values added for elements inside body relates back to 100% of the browser's own default font-size value - whatever that happens to be. '%' and 'em' are relative values when used on font-size, in the sense that they always are calculated based on the font-size inherited from parents. They are also relative in the sense that all browsers that can resize fonts can resize them - including our beloved Internet Explorer. In addition to that, by starting with a percentage we avoid the nasty "em font-resizing bug in IE5 - IE7"... <http://www.gunlaug.no/contents/wd_additions_13.html> ...which would otherwise make 'em' values somewhat problematic to use. As that article says; you could have started at the html-element, and you can even start at a wrapper-element inside body. Placing a base font-size much further in than that rarely ever makes sense. The point, or at least my point, is to give browsers a starting-point that makes sense size-wise, and to avoid that IE-bug at the same time. The latter is especially important since there are so many IE/win users around that may run into that bug :-) regards Georg -- http://www.gunlaug.no ______________________________________________________________________ css-discuss [EMAIL PROTECTED] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ List policies -- http://css-discuss.org/policies.html Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
