validateCssUnit

0th

Percentile

Validate proper CSS formatting of a unit

Checks that the argument is valid for use as a CSS unit of length.

Usage
validateCssUnit(x)
Details

NULL and NA are returned unchanged.

Single element numeric vectors are returned as a character vector with the number plus a suffix of "px".

Single element character vectors must be "auto" or "inherit", or a number followed by a valid suffix: px, %, em, pt, in, cm, mm, ex, or pc.

Any other value will cause an error to be thrown.

Value

A properly formatted CSS unit of length, if possible. Otherwise, will throw an error.

Aliases
Examples
validateCssUnit("10%")
validateCssUnit(400)  #treated as '400px'
Documentation reproduced from package shiny, version 0.9.1, License: GPL-3

Community examples

Looks like there are no examples yet.