[jQuery] Re: How to get font size in pixels?

2007-08-02 Thread Sam Collett
On Aug 1, 3:42 pm, "george.gsgd" <[EMAIL PROTECTED]> wrote: > Perhaps think around the problem. Can you get the height of the > element? That'd be in pixels regardless. > > Or maybe use sIFR instead? > sIFR was used, but now a server-side method generates the image (i.e. so Flash isn't required a

[jQuery] Re: How to get font size in pixels?

2007-08-02 Thread Klaus Hartl
Sam Collett wrote: Another problem is that it wouldn't work if you use % for font size (which is true in my case). Getting the height may be a good option (although that also includes padding). You simply need to use a reference element that doesn't have padding and borders. --Klaus

[jQuery] Re: How to get font size in pixels?

2007-08-02 Thread Sam Collett
On Aug 1, 11:13 pm, Luke Lutman <[EMAIL PROTECTED]> wrote: > I've run into this before, and came up with pretty much the same > solution as Klaus: > > http://jquery.lukelutman.com/plugins/px/jquery.px.js > > which you can call like so: > > $('#example').px('font-size'); > > One known bug is that i

[jQuery] Re: How to get font size in pixels?

2007-08-01 Thread Luke Lutman
Klaus Hartl wrote: > Couldn't you add an element as direct child to the body, for which you > define: > > position: absolut; > visibility: hidden; > height: 1em; > font-size: 100% !important; > > Then you can just poll the height of that element, e.g. the offsetHeight > and get the current pi

[jQuery] Re: How to get font size in pixels?

2007-08-01 Thread Scott Sauyet
seedy wrote: Sam Collett wrote: How can I then convert the %/em value into pixels? Short Answer : You can't really convert em to pixels as em is a relative value. Will this help?: http://davecardwell.co.uk/javascript/jquery/plugins/jquery-em/ -- Scott

[jQuery] Re: How to get font size in pixels?

2007-08-01 Thread Klaus Hartl
seedy wrote: Sam Collett wrote: How can I then convert the %/em value into pixels? Short Answer : You can't really convert em to pixels as em is a relative value. Long Answer: The default font size for browsers is 16px = 1em. So you could make that assumption and use 16px to calculate yo

[jQuery] Re: How to get font size in pixels?

2007-08-01 Thread george.gsgd
Perhaps think around the problem. Can you get the height of the element? That'd be in pixels regardless. Or maybe use sIFR instead? On Aug 1, 9:47 am, Sam Collett <[EMAIL PROTECTED]> wrote: > When I use $("h1").css("font-size") it differs across browsers. > Firefox returns it the way I want (in

[jQuery] Re: How to get font size in pixels?

2007-08-01 Thread seedy
Sam Collett wrote: > > How can I then convert the %/em value into pixels? > Short Answer : You can't really convert em to pixels as em is a relative value. Long Answer: The default font size for browsers is 16px = 1em. So you could make that assumption and use 16px to calculate your pixel