3

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...

Damon
  • 10,493
  • 16
  • 86
  • 144
  • related: http://stackoverflow.com/questions/4308989/are-the-decimal-places-in-a-css-width-respected or dupe? well to be fair theremis a lot of questions asked here. – Trufa Jan 24 '11 at 02:40
  • See http://www.w3.org/TR/CSS21/syndata.html#value-def-length. The answer seems to be yes. – Noldorin Jan 24 '11 at 02:41
  • Depends on browser: http://stackoverflow.com/questions/12604754/is-there-a-way-to-detect-if-the-browser-has-subpixel-precision – Victor Mar 07 '13 at 09:02

2 Answers2

1

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.

Scott Yang
  • 2,348
  • 2
  • 18
  • 21
0

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

FRAGA
  • 5,078
  • 1
  • 15
  • 13
  • 2
    [W3C](http://www.w3.org/TR/CSS2/syndata.html#length-units) mentioned that `px` can be a number value "with or without a decimal". – Brad Christie Jan 24 '11 at 03:23