smart-mobile-studio

Style property name format


I have noticed, that a style property name used in SmartMS has a different format than used in the css file.

e.g.:
in css:

line-height, text-overflow, white-space

in SmartMS the style properties don't have the '-' sign and are therefore CamelCase:

lineHeight, textOverflow, whiteSpace

Why are these differences?


Solution

  • The lower-case format (e.g. line-height) is used in css files. This format is a standard for all browsers.

    The CamelCase format (e.g. lineHeight) is used on the javascript object internally in the browser. This format is also a standard for all browsers. But some browsers also support the lower-case format.

    To be cross-browser compliant, always use the CamelCase format, on the javascript object!