Forum How do I...?

CSS3 Units

dancotter
Is there a list of what units are and are not supported?

I have noticed that ch, rem, vh, and vw do not work. ex sort of works but is usually wrong.
mikeday
in, mm, cm, pt, pc, q, px, ex :)

As you say, ex is a tricky unit and is currently treated equivalently to 0.5em.
dancotter
Thanks mike.

I ended up making a page to test units as attached, might be useful for someone. Green bars should be around half the view if the view is set to size A4.

Working: % px mm cm in pt pc em

Not accurate: ex

Not working ones are: ch, rem, vh, vw, vmin, vmax.

Chrome supports all of them, except they too seem to estimate ex and ch which is understandable.
  1. unitsA4.html1.1 kB

Edited by dancotter

rlpowell
It's too bad about rem :(

I don't like em's cascading behaviour, I find it confusing.
mikeday
Prince latest builds now support rem units! :D
shorshe
Hi Mike,
fitting text into a box is one of my major obstacles. I'd like to think "vw" would help me in this scenario. Is support for vw anywhere on the roadmap?
mikeday
Yes vw/vh units are on the roadmap. although we are not working on them right at this moment.
dauwhe
I randomly ran a web platform test on letter-spacing, which fails in Prince because "ch" isn't supported.
mikeday
The Prince latest build now includes support for vw/vh/vmin/vmax units (and also pvw/pvh/pvmin/pvmax, relative to the page size including margins).

Edited by mikeday