Inline Styles Back

In React, inline styles are not specified as a string, but an object like this:

var divStyle = {
    color: 'black',
    backgroundImage: 'url(' + imgUrl + ')',
    WebkitTransition: 'all',
    msTransition: 'all'
};

ReactDOM.render(
    <div style={divStyle} >Hello World!</div>,
    document.getElementById('content')
);

Style keys are camelCased in order to be consistent with accessing the properties on DOM nodes from JS. However, Vendor prefixes other than ms should begin with a capital letter. This is why WebkitTransition has an uppercase "W".

Empty Comments
Sign in GitHub

As the plugin is integrated with a code management system like GitLab or GitHub, you may have to auth with your account before leaving comments around this article.

Notice: This plugin has used Cookie to store your token with an expiration.