April 17th, 2003, 03:48 PM
font size in css
imho the only way to circumvent the font-resizing by selecting 'large fonts' in Windows' desktop properties dialog is to specify it absolute in px rather than in pt's.
Can anyone tell me the disadvantages in doing so ?
April 17th, 2003, 09:13 PM
Actually, in CSS a px is a relative unit too, and it is not necessarily the same as a pixel on screen: CSS @w3c. All browsers, except Explorer, also scale pixel settings.
April 18th, 2003, 12:09 AM
So there is actually no way to keep a font size setting as intended ?
April 18th, 2003, 02:04 AM
April 18th, 2003, 11:52 AM
MJE, the px unit is relative to the output device, so it is not a relative unit in the same sense that the others are. When the output device is a monitor, do you think there are any browsers that perform the calculation described in the CSS 2 spec?
My guess is that they use the literal value specified, that is a 1:1 ratio of specified pixels to physical pixels. I tested that in IE 5 and NS 6 (both Win) by setting a font-size in px units and taking screenshots at two different resolution settings, 800x600 and 1280x1024. Neither browser rescaled the pixel values, as should happen according to the CSS 2 spec (assuming the difference in pixel density betweent those two resolution settings was enough to warrant it, which I think it would be).
Browsers that change the size of text set in px units when the user changes text size settings should not be, because what the user adjusts (the text size setting) does not change the resolution of the output device.
April 18th, 2003, 01:34 PM
Well, a 12px is not necessarily 12 pixels. On a monitor yes, but on a printer for example, the type is much larger than 12 printer dots.
I would expect that at normal size, a 12px font is 12 pixels high, and no, the CSS spec calculation likely isn't done. Whether or not the browser should adjust text sizes that are set in pixels is really irrelevant, the point is that recent browsers do scale it. I was pointing out that Gerhard's assumption that the font size would be constant is wrong.
April 18th, 2003, 06:15 PM
Re: monitor / printer -- true indeed. However, that consideration is no reason not to use anything (such as a particular unit) that you need to make your page appear properly in the browser, because that would much more practically be handled by the use of media-specific styles.
On the contrary, nothing could be more relevent to anyone who is interested in doing standards based development, which is anyone with any sense.
From a perhaps more obvious common sense standpoint, it's a terrible idea not to have a way in CSS to be able to fix font sizes at will. With that ability, page features (e.g. links in a navigation bar) could often be generated with markup & styles, safe in the realization that your layout won't be destroyed by resized text (particularly if it incorporates images). On the other hand, without that ability the developer would often be forced to implement those features using images. Of course it is not a good idea in general to set your actual content text to a fixed size.
Yes, I understand completely, it was very helpful of you to let him know that. However, I wanted to express that his logic was correct, clarify the nature of the px unit, and explain that the resizing behavior of browsers that you described in such chilling detail is flawed.
April 19th, 2003, 01:34 AM
Good point, that shold be the way it works, but unfortunately, it isn't.
Yes, but equally important is the ability to use the code. I realize you're not disagreeing with me, but let's keep it clear that compliant code isn't necessarily good code if it produces undesired effects for some users (as assuming that pixel sizes don't scale can do). I don't, for example, use most CSS2 selectors in my style sheets, because despite them being extremely useful, they leave any one using Explorer out in the cold. My style sheet laden with selectors is proper code, but not too useful (for the time being).
It's always important to consider both standard and use.
Last edited by MJEggertson; April 19th, 2003 at 01:36 AM.
April 19th, 2003, 03:16 PM
Thank you all for enlighting me...
I think, the best idea is it, of course, to use a layout, which is resistant to font size to a large extend.
However, especially if using some graphics, too, this is not always possible. In that case I would prefer the method of using the pixel unit rather than e.g. using graphics as navigation.
Again, thank you,
April 24th, 2003, 04:27 AM
browser resizing can be a good thing...
I have to write a lot of sites with accessibility in mind, so I need to use font units that the browser can resize. However, it seems most peple say that the pt unit is the relative unit and px is fixed, but px is the only one of the two that ie will resize when you click [view] [text size] ....
Is there a font unit that will always resize regardless of which browser you are using, and also a unit that will never resize, (even if they appear slightly bigger or smaller, like the mac / pc thing. I can live with that..)
anything is possible -- with the right budget!
April 24th, 2003, 04:48 AM
you can use em
if you also use em in height/lenght unit on elements, the elements wil scale with the font size,
most of the time i only use em and/or % ,
so that the pages are completly scalable,
April 24th, 2003, 05:21 AM
it's funny that this keeps coming up... but if you go to msn.com you'll notice that they do have fixed font sizes....
In Ie you can't simply change the size fromt the toolbar.
don't know about using personalized styles...but that alone tells us something.
just a passing thought.
April 24th, 2003, 06:02 AM
I've been investigating...
OK, results of a bit of testing for those who are interested.
Opera :: Can enlarge any text in any unit by zooming in on the page.
Netscape 7 :: Same as Opera but doesn't do quite as good a job, seems to distort layout a bit on some pages.
Netscape 4.7 :: Barely makes any changes with px if anything. Works much better with pt units. (But you shouldn't be using this browser any way!!)
IE 6 :: Makes no changes to pt units, but enlarges px units just fine.
My conclusion :: px units seem to be a fairly similar size across the board for users who don't change their default font size, (mac users excluded), but can also scale well on the most popular browsers, so I think that px gets my vote.
Any one else want to contribute findings with other browsers / units??
anything is possible -- with the right budget!
April 24th, 2003, 12:35 PM
Pixel and size (mm, in...) measurements are the most consistent across all platforms, but they scale with screen resolution. Point sizes (pt) are notoriously difficult to work with, because a point on a Mac is way different from a point on a PC of any flavor. Not sure about nix systems.
I too like the em. They're a little tricky to wrap your head around, but I like them because they scale so well. An em is equal to the computed font-size of an element if it is used to measure a non-font-size width, otherwise it refers to the font size of the parent element if used to set the font-size property. It makes defining inherited size properties real easy (after a little bit of practice), since when done properly, all sizes, from font sizes to element widths, padding, and margins, can be set to scale by changing the base font-size of the root html element.
Last edited by MJEggertson; April 24th, 2003 at 12:39 PM.