Click to See Complete Forum and Search --> : Default Text Size
msjordan
02-14-2007, 12:56 PM
I have inherited a company intranet site that is coded in XHTML strict & CSS.
In going over the style sheet there is something I don’t understand.
There are many “font-size” references thru the CSS code and they are defined with “small”, “%’s” and “em’s” – but no where is there an actual definition of a font-size
ie font-size: 10px;
Is there a default font-size in XHMTL or CSS ?
Thanks
MS Jordan
The default is the browser default, depending on the user's/browser's setting, as well as the type of font used.
Em, %, and small are relative values with respect to this.
This might help, though: http://riddle.pl/emcalc/
KDLA
ReddMurphy
02-14-2007, 03:29 PM
This is slightly off-topic, but on my latest venture I defined font-size for the body like this:
body{
...
font:x-smal Arial, Verdana, sans-serif;
voice-family: "\"}\"";voice-family:inherit;
font-size:small;/*for IE 5.5 */
} html>body {font-size:small;}
This is a technique I learned from Dan Cedarholm's book, Bulletproof Web Design.
What it does is sort of create a fairly consistent default font size (across browsers) using the keywords. Then, when I need a different size, for anything, I make it a percentage of the size it inherits from the body.
It might make your life easier (if it's even feasible) to convert to this method. then you don't have to worry about anything but percentage sizes. So You get almost pixel perfect control for default browser settings and users can still increase or decrease the text size if they want.
msjordan
02-17-2007, 10:33 AM
KDLA
Thanks
I was aware of what em, % and "size" were - what I was trying to get my head around was the lack of a "default" font setting in the css code.
Question - is the lack of "default" setting a good or bad thing from a standards point of view - my thinking says it's a bad thing since you set can set a div's size and you obviously set the size to contain a certain amount of text or images - it would seem that not setting a "default" size is not a good thing
You could set a div's height according to "em" rather than pixels. That way, it'll always stretch to fit the text since the sizing is text-based.
KDLA
WebJoel
02-17-2007, 11:45 AM
body{
...
font:x-smal Arial, Verdana, sans-serif;
voice-family: "\"}\"";voice-family:inherit;
font-size:small;/*for IE 5.5 */
} html>body {font-size:small;} I assume this is supposed to be "small". :)
Yes, -I too am sort-of experimenting with 'cross-browser defaults' for text sizing. Question, -is this the first item in the Selector "body", or the last item? Typically, I like to declare a font-size in BODY like "font-size:85%;" and then follow-up with this (above) hacking method. This method is for "keywords" like "small" etc., which I tend to never use but maybe should.
ReddMurphy
02-20-2007, 08:18 AM
I assume this is supposed to be "small". :)
Yes, -I too am sort-of experimenting with 'cross-browser defaults' for text sizing. Question, -is this the first item in the Selector "body", or the last item? Typically, I like to declare a font-size in BODY like "font-size:85%;" and then follow-up with this (above) hacking method. This method is for "keywords" like "small" etc., which I tend to never use but maybe should.
Yes, I meant "small". Sorry about that.
If I understand your question, this is the last item in "body". But my code snippet includes everything related to text size.
A couple questions for you now:
I think you are saying that you default to 85% if the browser doesn't understand keywords. Is that accurate? If so, can you tell me which browsers don't support keyword sizes? Also, if you default to 85%, what does that mean? In other words, 85% of what?
Thanks