can an element have a a decimal height in html/css?

别说谁变了你拦得住时间么 提交于 2019-12-11 03:35:19

问题


I am working on a site, when I look at it with firebug in firefox various elements seem to have heights like 133.8 pixels, whereas firebug lite in chrome reports the height as 133px for the same method. Is this a difference in the browser rendering, or is it just a curiousity brought on by firebug? I thought pixels had to be measured in integers...


回答1:


You can have decimal values in units other than px. Like em, in, etc.




回答2:


Funny thing. I just tried today and booth Chrome 25 and Firefox 19 seemed to support it, and I even used inline img width and height:

<img src="something" width="39" height="21.5" />

I had a series of tiles with absolute positioning connected to form a diagonal line, and I know it worked because the line was wavy and I had to use the .5 to make it straight.



来源:https://stackoverflow.com/questions/4778109/can-an-element-have-a-a-decimal-height-in-html-css

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!