If you look at themeroller.css with your favourite web page inspector then you'll find this:-
#themeroller {
font-size: 10px;
}
#themeroller button,
#themeroller input,
#themeroller select,
#themeroller textarea {
font-size: 12px;
}
A bit of digging in the HTML reveals that <div id="themeroller">
encompasses the entire "demo" area of the page so ALL the jquery-ui widgets are inside it and therefore take their font-sizes relative to these values.
Looking at my "too big" page, normal text has a font-size of 18px. This comes from .ui-widget in themes/ui-darkness/jquery-ui.css having font-size: 1em
which it calculates from my browser's base font size of 16px. I discovered this base size by inspecting a simple document:
<html><body>
<span style="font-size: 100%">here is some plain body text</span
</body></html>
So the answer to the question of how to set the font size for jquery-ui widgets is to set the font-size for an enclosing element. <body>
(as recommended by Joseph Marikle) is guaranteed to hit everything but might be too wide for your needs, in which case you should use an inner <div>
instead. <span>
is probably evil because you shouldn't wrap block-level things in non-blocks - but check that assertion with the CSS Style Police, I'm just a hacker!
I was going to rant about why the designers chose to base heights on em
, which is a width, rather than ex
, which is a height. However, I suspect the answer is that em
gives you more consistent results over a wider range of fonts, as most times the height of an 'l' is about the same as the width of an 'm'. Conversely, if you used 2ex
as your basic measure then you'd get weird heights in fonts with very short or very long ascenders and descenders when compared to the height of an 'x'.