Style Name Syntax

In regular JavaScript, style names are written in hyphenated-lowercase:

const styles = { 'margin-top': "20px", 'background-color': "green" };

In React, those same names are instead written in camelCase:

const styles = { marginTop: "20px", backgroundColor: "green" };

This has zero effect on style property values, only on style property names.

Community Forums
Get help and ask questions in the Codecademy Forums
Report a Bug
If you see a bug or any other issue with this page, please report it here.