[英]get jquery to return font-size in points
when I use .css('font-size') in jquery, it returns the value in pixels, is there any way to making it to give it in points ? 当我在jquery中使用.css('font-size')时,它返回以像素为单位的值,有没有办法让它以分数形式给出它? it's because I want to use it in php gd, and it requires the font size to be in points
这是因为我想在php gd中使用它,它需要字体大小为点
Try this: 尝试这个:
var fontSize = ...
var points = parseInt(fontSize) * 72 / 96
If your font-size
is defined in pt
then you may access the fontSize
property of element.style
as follows... 如果你的
font-size
是用pt
定义的那么你可以访问element.style
的fontSize
属性,如下所示......
var element = document.getElementById('my_element'),
//return size as it is defined
fontSize = element.style.fontSize;
以上是略有修正:(parseFloat($(this).css(“font-size”))* 72.0 / 96.0).toFixed(2)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.