Px

Converts the specified number to a pixel string.

CategoryStrings
AuthorPol Gubau
Since1.0.0
Last Updated2025-03-15
TypeSync
CompatibilityUniversal

Example

  • Input

    px(10)

    Output:

    '10px'
  • Input

    px('10')

    Output:

    '10px'

Return

Returns the input number or string with 'px' appended at the end.

Type: string

Props

NameTypeDefaultRequiredDescription
argstring | numbernullYesThe number or string to convert into a pixel string.

Notes

If the input is a string or number, it will be converted to a string and suffixed with 'px'.

Tags

  • conversion
  • unit
  • px
  • string

Related