Detect Font Size In Pixels Using Jquery
How can I detect font size using jQuery? If I am using em and i need to detect font size in pixels
Size of font in pixels?
Solution 1:
Solution 2:
Solution 3:
Have you tried using this method?
var size = $(element).css('font-size');
Solution 4:
Try this,
functionem(input) {
var emSize = parseFloat($("h1").css("font-size"));
return (emSize * input);
}
Solution 5:
use css()
to get the font-size... this gives the size in px... so divide it by 16 should give you the value in em
.
try this
var sizeinem=parseFloat($('h1').css('font-size')) / 16;
alert(sizeinem);
fiddle here
Post a Comment for "Detect Font Size In Pixels Using Jquery"