"1em"
) into the number of pixels
this represents.R/numeric-values.R
css_string_as_pixels.Rd
This function is a small wrapper around css_string_as_length()
and
css_length_as_pixels()
.
css_string_as_pixels(x, percentage_as_fraction = TRUE, ...)
x | Character string of a CSS value e.g. "12", "12px", "3em", "47%" |
---|---|
percentage_as_fraction | Default: TRUE means that if a value is given as
"50
|
... | other arguments passed to |
a numeric value for this length in pixels as best we can with limited knowledge
This function does some naive conversions, and assumes the display is 96dpi.
For more control on the final result, the user is encouraged to use
css_string_as_length()
and hand-roll their own unit conversion to
their display units. This can be tricky as some units rely on rendering
viewport sizes and font-size on the root node - thus i'll leave that for
the user to handle.