React: z-index in component

Created on 27 Apr 2014  路  4Comments  路  Source: facebook/react

When try to set z-index of a div inside a component via style={"z-index": "-99"} it doesn't work. In element inspector it becomes "z-index: 0px".

Is there workaround for this?

Most helpful comment

If you use zIndex it'll work correctly (and you won't have to quote it!). That really should warn you -- we have #932 open for adding a warning.

All 4 comments

If you use zIndex it'll work correctly (and you won't have to quote it!). That really should warn you -- we have #932 open for adding a warning.

So many other properties are supported with quotes. Why is this one any different? This is inconsistent.

Please disregard, for some reason I am finally seeing the errors for other styles which used dash. Camel case is the standard.

We've had this warning since React v0.12 in 2014 now. (One of @gaearon's first PRs!)

Was this page helpful?
0 / 5 - 0 ratings