FAQ: Style - Style Name Syntax

This community-built FAQ covers the “Style Name Syntax” exercise from the lesson "Style ".

Paths and Courses
This exercise can be found in the following Codecademy content:

Web Development

Learn ReactJS: Part II

FAQs on the exercise Style Name Syntax

There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply (reply) below.

If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

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.

this was on a lesson about style in React whic says that in Javascript style names are written
in hyphenated-lowercase but i learned that in JS style property are camelCase can some one explaine me because i get confused

The lesson using the term ‘regular JavaScript’ is kind of ambiguous. They mean ‘CSS’. I believe that by referring to regular JS they are also referring to how we use CSS in conjunction with HTML and JavaScript as opposed to React.