An object containing all CSS properties that may be used without a unit. The .css() method uses this object to see if it may append px to unitless values.

jQuery.cssNumber()🡢 Object

You can think about jQuery.cssNumber as a list of all CSS properties you might use without a unit. It's used by .css() to determine if it needs to add px to unitless values.

The keys of the jQuery.cssNumber object are camel-cased and the values are all set to true. If you want to prevent the .css() method from automatically adding the px unit for a specific CSS property, you can add an extra property to the jQuery.cssNumber object.

jQuery.cssNumber.someCSSProp = true;

By default the object contains the following properties:

  • zIndex
  • fontWeight
  • opacity
  • zoom
  • lineHeight
  • widows (added in jQuery 1.6)
  • orphans (added in jQuery 1.6)
  • fillOpacity (added in jQuery 1.6.2)
  • columnCount (added in jQuery 1.9)
  • order (added in jQuery 1.10.2)
  • flexGrow (added in jQuery 1.11.1)
  • flexShrink (added in jQuery 1.11.1)

Looking for a Web Developer?


Hi! I'm Basti, author of this site. If you are looking for a web developer with 15+ years of experience, holla at me!

Be it the good 'ol jQuery, vanilla JS or modern frameworks like Vue and Svelte, front- or backend, I can help you.

Just write me at jobs@jqapi.com :)