Forum Moderators: not2easy
So if I want to make them adjustable, but have the default settings exactly as I've specified currently - i.e. when visitors arrive, no matter their current settings they'll get what I have set - but after that they can adjust to whatever they want - how do I do that?
I may be asking too much. I currently use the px setting for font sizes. Does the em or pt or whatever setting make a difference in that regard?
I just don't want to change my settings to percentages and end up with chunky text - I really like my carefully selected sizes, it's a shame if I now have to jigger around to get it looking right again only to discover everybody sees everything their own way if I do that.
only to discover everybody sees everything their own way if I do that
That's what will happen - 1 em is whatever default font the user has configured in their browser.
when visitors arrive, no matter their current settings they'll get what I have set - but after that they can adjust to whatever they want - how do I do that
A change of units won't accomplish this goal. You'd need to create one or more extra style sheets and then give the user an onscreen option through scripting to select the one they prefer.
I've seen webpages on HTML and CSS and some say 'relative is best' some say 'absolute is best'. Coupled with frustration at the mixture of what has been adopted in each browser version. It appears to be just use whatever works right for you.
A javascript thingy that will auto detect and set up different stylesheets seems to be a hell of a complicated way to go for something that should be so simple.
I am torn.
I experimented with EM just now and that was a minor disaster. It seemed to take 'relative' a lot more literally and confused me.
Remember that ems inherit. This means that the em value of an element is rendered relative to the em value of it's parent element. So, if you have one element set to 1.2em inside a parent element set to 1.3em, the text size will be 1.56 times bigger than the user's default browser size (because 1.3 of 1.2 = 1.56). I've got a feeling this will explain your unexpected results.
all the schemes for relative sizing suffer from cross browser cross OS problems, although using font-size in css hacked to accommodate different default font sizes (ie setting font-size: small, or x-small depending on browser, IE 5 gets x-small, IE5/Mac, Netscape 6, Mozilla, IE6/Win get small) and using a different stylesheet for NN4 with fixed sizes, seems to come closest to working. It doesn't give you much at all to work with in terms of a range of sizes, but at least it isn't tiny or huge without warning.
No good solution is the bottom line. I generally set px sizes, and leave them a little larger than I might otherwise.
Every browser should have Opera's zoom page function.
Does anyone know of any problems associated with percents that I should be aware of?
but it does let itself be overridden much better by the browser (IE 5 and above).
i.e. if you set font size to 1em and then try and manually set Text Size in the browser to 'larger' or 'smaller', it magnifies or minimizes it to the extreme.
whereas if the font size is set using %, then 'larger' just makes it a bit larger, and 'smaller' a bit smaller - much easier to fine tune.
correct if wrong, i am actually in process of learning all this myself ;)
I've found this article on text sizing very helpful:
[alistapart.com...]
I've had trouble with ems and more recently with the relative sizes (small, large, etc.). When the dust settles and browsers finally render text similarly with ems, I'll go back to them.
In fact, I was using javascript sniffer to hand off different style sheets to different browser platform combos. This used to work fairly well, but now that IE6 does font sizes differently, the sniffer and number of style sheets got unwieldy.
Well, maybe they didn't work all that well. As the article points out, you have to guess what settings the user has set for their display--an impossibility.
I'm moving to px for sizing text and I'm trying to do it with just one style sheet.
I'm not worried about accessibility at this point because an "expert" at Human Factors once told me that people who really need huge text have special programs that expand pages for them. So they don't even use the methods the W3C calls for!
I'm not saying don't use px but don't be fooled into thinking that hard coding font sizes is okay. It's not. Many people fall into a category between needing special programs and normal vision.... just people with short/long vision and all the many variations of eye problems that are extremely common in ordinary folk.
Just my thoughts, and I don't always follow my own ideals either ;)
Nick
You'll probably have to scroll to see non-fluid sites that have been designed for 800 or larger, but everything is a compromise, isn't it?
The key here, I think, is that no matter what designers do, you can decide how big you want the text to be.
I'm not worried about accessibility at this point because an "expert" at Human Factors once told me that people who really need huge text have special programs that expand pages for them. So they don't even use the methods the W3C calls for!
First I've heard of this. Unless it's a standard magnifier application. Any chance you know the names of the programs? I like to try them out.
Tools > Internet Options > Accessibility
...you'll find where users with visual disabilities can override any style sheets. The biggest problem I see with relative fonts is that most people are not aware they have the ability to add a button to their IE toolbar that will allow them to adjust their font size. Nor are they aware that you can go to...
View > Text Size
...and choose from 5 different font size settings with Medium being the default setting. There are just too many variables involved when it comes to using ems or any relative font size unit. IE I believe is the only browser that lets the designer take control of font sizing away from the average user. All the other browsers do not. But, since IE is the predominant browser, you've got to work around its faults and try to come to a happy medium for all browsers. If that is possible.
The form changes the font size of body and p tag in px.
Then I set the font size of the information (some div's and span's) to em.
Since em inherits the parent size (which is body and p tag), when you change the font size for body and p tag, the whole document would follow .
best of both worlds. Em and Px. :)
Do a search on "limited vision reader magnifier" and see what comes up. A couple of pages I found are: http://www.freedomscientific.com/fs_products/software.asp
http://www.otal.umd.edu/UUPractice/vision/
I wonder if it was necessary to put this:
$fontsize='medium';
in the css declaration? Couldn't you leave it out and thus shorten the script even further?
p {font:<?if(!$fontsize){$fontsize='medium';echo$size;}else{echo($fontsize=='large'?$size+2:$size-2);}?>px ....
Thanks for sharing your creation with us.
Art
> I wonder if it was necessary...
You're right, it's not necessary for the functioning of the script, but I wanted to return an indication of which size the viewer had chosen, that is:
Font size = <?=$fontsize;?><br> Without it the 'medium' size would show 'Font size = *blank*'. Try it. :)
I first attempted writing this in javascript. Was much easier in PHP.