random memes }

CSS gone wrong - java.net

Argh. Had too many annoyances to clear out of late - I am all out of tolerance. You are warned.

Opened up java.net again today. Saw the too small text, again. Could hit "Ctrl-+", again ... but not today. Turned on Firebug (a wonderful tool, BTW), clicked "Inspect" and on the undersized text. The offending bit of style:

body, th, td, p, div, dl, li, select, input, textarea, blockquote { font-size: 12px; }

Right. The font size is defined in pixels. Dumb. Always has been. For those of you who were asleep when you should have been paying attention, please remember, the number of pixels per inch is not the same for all screens. Specify anything in pixels, and you will get different sizes on different screens.

This is one of those common mistakes I have seen repeated over, and over, and ... over the past twenty-odd years.

In CSS that is what "pt" (point) sizes are all about. If your system is set up properly, point sizes will yield the same visible size, independent of display resolution. Used Firebug to change the "12px" to a proper "10pt". Much better! There are other "px" font sizes in the style sheets that need to be cleaned out, but just the one change makes the bulk of the text readable.

Oh right. The java.net site is using table-based layout. Grrr....

So just who exactly is responsible for the java.net site? In About ... nope. Perhaps Feedback? No obvious link to whomever styles the website. A general search on "CSS" yields one possibly relevant hit on font size.

Forum Wish List From sarahb Subject Re: Font size Date 2004-03-30 21:45:48 GMT

Hi Patrick,

Thanks for your message. The CSS on our pages uses pixels to set the font-size. Currently this causes IE's text enlarging to not work. This is easy to get around, though. All you need to do is go to Tools->Internet Options (in IE) and choose Accessibility (near the bottom). Then check the "Ignore font sizes specified on Web pages" box.

There are a number of reasons we chose to use pixels to set the font size. Here's a good reference for CSS issues if you're interested: http://www.aglasshalffull.org/css-resources/CSS-Issues.htm

Regards, Sarah java.net Producer

Well, that is an answer - if wrong.

Tracking things down this far was tedious. For some reason the java.net site is SLOW. Bit disturbing, as Sun produces some really wonderful hardware, and given all the interesting work going into optimized the JVM. Not exactly a showcase.