Movatterモバイル変換


[0]ホーム

URL:


🇺🇦 STOP WAR IN UKRAINE 🇺🇦
Avatar

Emotion

Object Styles

✏️Edit this page

Writing styles with objects is a powerful pattern built directly into the core of emotion. Instead of writing css properties inkebab-case like regular css, you write them incamelCase, for examplebackground-color would bebackgroundColor. Object styles are especially useful with the css prop because you don't need a css call like with string styles but object styles can also be used with styled.

Examples

With the css prop

(Edit code to see changes)

Withstyled

(Edit code to see changes)

Child Selectors

(Edit code to see changes)

Media Queries

(Edit code to see changes)

Numbers

When numbers are the value of a css property,px is appended to the number unless it is a css property that is unitless.

(Edit code to see changes)

Arrays

Nested arrays are flattened.

(Edit code to see changes)

Fallbacks

Define fallback values for browsers that don't support features with arrays.

(Edit code to see changes)

Withcss

You can also usecss with object styles.

(Edit code to see changes)

Composition

Learn more composition in Emotion.

(Edit code to see changes)

Getting Started

Advanced

Tooling

Packages

Posts


[8]ページ先頭

©2009-2025 Movatter.jp