jQuery / CSS:line-height of“normal” ==?px [英] jQuery/CSS: line-height of "normal" == ?px

查看:300
本文介绍了jQuery / CSS:line-height of“normal” ==?px的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我调用 $(#foobar)。css(line-height)并返回normal。如何将此值转换为像素量? /css-class.com/test/css/text/linebox-line-height-011.html\">此页,似乎大多数最近的浏览器使用相同的值 line- height:normal :1.14,id为 font-size 属性,系数为1.14。



尝试使用多种浏览器(在Windows XP上):




  • Chrome 21.0.1180.75

  • Firefox 14.0.1

  • Safari 5.1.7

  • Opera 11.64

  • IE 7

  • IE 8



b

我错了, line-height 取决于 font-family -size ,您的浏览器,也许您的操作系统...



更多阅读 Eric Meyers的网站


I'm calling $("#foobar").css("line-height") and getting back "normal". How do I translate this to a pixel amount? Is "normal" defined in the CSS spec or is it browser specific?

解决方案

According to this page, it seems most of recent browsers use the same value for line-height: normal : 1.14, id est the font-size property with a 1.14 coefficient.

Tried with several browsers (on Windows XP) :

  • Chrome 21.0.1180.75
  • Firefox 14.0.1
  • Safari 5.1.7
  • Opera 11.64
  • IE 7
  • IE 8

EDIT

I was wrong, line-height depends of font-family, font-size, your browser, maybe your OS...

More reading on Eric Meyers' website.

这篇关于jQuery / CSS:line-height of“normal” ==?px的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆