PGoCareerGoCareer prep tools
Home
LoginSign up
  • Java
  • Python
  • AI
  • React
  • Angular
  • PHP
  • Node.js
  • SQL
  • DSA
  • HTML
  • CSS
  • JS
  • Spring
  • ML
  • MongoDB

React · Theory

Inline Styles in React

← All stacks

Theory

53/94

Inline Styles in React

Inline styles are a JS object: style={{ color: 'teal', fontSize: 18 }}. CamelCase properties. A number means px (except unitless ones like fontWeight). Two braces: outer JSX expression, inner object.

Good for tiny dynamic values (width from state). Bad for hover, media queries, theming a whole app. Don’t build a design system out of inline styles.

Inline Styles in React — on screen — ₹199 in teal 18px. fontSize not font-size. 18 means 18px.

Exam tip

Two braces + camelCase + when not to.

Example

// Inline style
export default function Price() {
  return <strong style={{ color: "teal", fontSize: 18 }}>₹199</strong>;
}

Inline Styles in React — on screen: ₹199 in teal 18px. fontSize not font-size. 18 means 18px.

Short notes

  • Defstyle={{ camelCase: value }}.
  • Number : px.
  • Usesmall dynamic bits.

Questions

1

Explain Inline Styles as if you are teaching a junior — definition, then one tiny UI.

2

What does the example show on screen (or print), and what does that prove?

3

What mistake do freshers make with Inline Styles?

Previous← React HelmetNextjQuery vs React →
P

GoCareerGo

Utilities · Preparation Hub · Resume · CV · Tools — one workspace.

Workspace

DashboardProfilePreparation HubResume builderCV builderCareer planning

PDF Tools

Merge PDFSplit PDFCompress PDFImage to PDFAll toolsJobs

Image & QR

Compress ImageResize ImageQR ScannerQR GeneratorBlogIT interview prep

Company

FAQFeedbackContactPrivacyTermsSitemap

© 2026 GoCareerGo. Keep moving forward.