Re: Relative font sizes

Jim Byrne wrote:
>There is more chance - if you are not careful - of ending up with unreadably
>small text if a size is set in the body selector - because of the issues of
>inheritance. For example, if you set the body to .9em - and then set the
>paragraph selector  to .9em, and then set anchor selector to .9em - the
>resulting link in a paragraph will be 90% of 90% of 90% of the browser
>default size; it could get difficult trying to figure out why your links are
>so small. 

If you don't pay attention to inheritance, then not setting the body 
size won't save you. You could still set a <p>, <strong>, and <a> to 90% 
sizes, have them all inherit from the default body size and still be 
unreadable.

This inheritance problem (and a brief solution(1)) is mentioned in the 
second half of http://css-discuss.incutio.com/?page=AvoidingHacks

Without getting into too much CSS here, you can reset nested elements' 
font-sizes back up to 1em. p a {font-size: 1em;}

>With a good understanding of all the issues this can be avoided. So it
>depends on who is designing the page - and how aware they are of potential
>problems; for that reason I think it is safer not to set a size in the body
>selector.

But you have to give the users here some credit. Although they 
definately aren't all full-time developers, the mere fact that they are 
on this list means they pay more attention to web technologies than most 
(probably more than a lot of full-time developers).

Even so, I don't think ignoring the default size makes it any easier. 
The same problems still arise unless you pay attention to inheritance.

>There are problems with most units of measurement - including using keywords
>- see http://www.alistapart.com/stories/fear4/4.html for some discussion on
>problems with keywords. However I do agree that keywords are a good idea -
>and if the balance of problems/virtues moved towards keywords I would be
>happy to start using them.

That article was written several years ago and couldn't take into 
account many developments in the past few years. At that point, no Gecko 
browser was released; now there are at /least/ five (N6, N7, Mozilla, 
Phoenix, Chimera, etc.) and all of them render keyword sizes correctly. 
MacIE5, Opera, Safari/Konqueror render them correctly too, I believe. 
Windows IE5 and IE6 will render them correctly if you employ a few CSS 
comment hacks. (I think all those browsers render em and percentage 
sizes correctly, too, if implemented correctly.)

Version 4 browsers and below still have trouble with keywords, though 
more and more authors are hiding all styles from those browsers via the 
@import method. If the HTML elements are used semantically, it's still 
very readable, accessible, and usable. As someone else mentioned, see 
Netscape DevEdge in any compliant browser (previous paragraph) and then 
again in and older browser like Netscape 4, Lynx, IE3, Mosaic 1, etc.(2)

Cheers,
James Craig

1. The 'brief' solution mentioned is definately not a complete end-all 
fix to this problem, but it does correct the most common problem with 
font-size inheritance.

2. Jim, I realize you are familiar with this. That last example was more 
for the other list members' benefit. I think we're pretty much in 
agreement besides that one small detail on the body size. We may have to 
agree to disagree. ;) Thanks for you response.

Received on Wednesday, 16 April 2003 11:45:12 UTC