Styling specifies and applies visual presentation rules to an interface. React projects can express those rules through CSS files and class names, CSS Modules, styled-components, inline CSS, or Tailwind CSS; no approach is universally best because project, team, audience, and preference change the trade-offs. section 7.0 section 7.6
Select a styling approach by weighing language support, developer experience, and application behavior:
- Use CSS files and class names for familiarity and simplicity, especially when a project is small; expect weaker scaling and possible class-name collisions. section 7.0 section 7.7
- Use CSS Modules when autogenerated class names can improve collision resistance and scaling without substantially changing regular CSS authoring. section 7.7
- Use styled-components when colocating JavaScript, HTML, and CSS improves component overview, particularly in medium-to-large projects; reassess the benefits for very large components. section 7.7
- Compare inline CSS and Tailwind CSS alongside the other options rather than treating any library as a default, because ecosystems and requirements change. section 7.6
Table 7.1 Evaluating CSS methods on several attributes
|
Category and attribute
|
Inline CSS
|
CSS files
|
CSS Modules
|
Styled- components
|
Tailwind CSS
|
|---|---|---|---|---|---|
|
Folder
|
inline
|
classnames
|
cssmodules
|
styled
|
tailwind
|
|
CSS language features
|
|||||
|
Specificity
|
!
|
✗
|
!
|
✓
|
✗
|
|
Collisions
|
✓
|
✗
|
✓
|
✓
|
✓
|
|
Composition
|
✗
|
!
|
✓
|
✓
|
!
|
|
Pseudoclasses
|
✗
|
✓
|
✓
|
✓
|
!
|
|
Pseudoelements
|
✗
|
✓
|
✓
|
✓
|
!
|
|
At-rules
|
✗
|
✓
|
✓
|
✓
|
!
|
|
Conditional rules
|
✗
|
✗
|
✗
|
✓
|
✓
|
|
Dynamic rules
|
✓
|
✗
|
✗
|
✓
|
✓
|
|
Vendor prefixes
|
✗
|
✗
|
✗
|
✓
|
✓
|
|
DX
|
|||||
|
Colocation
|
✓
|
!
|
!
|
✓
|
✓
|
|
Familiarity
|
✓
|
✓
|
✓
|
!
|
✗
|
|
Simplicity
|
!
|
✓
|
!
|
!
|
✗
|
|
Scaling
|
✗
|
✗
|
!
|
✓
|
✓
|
|
Readability
|
!
|
✓
|
✓
|
!
|
✗
|
|
Debugging
|
✓
|
✓
|
!
|
✓
|
!
|
|
Encapsulation
|
✗
|
!
|
!
|
✓
|
✓
|
|
Theming
|
✗
|
!
|
!
|
✓
|
✓
|
|
Web application development
|
|||||
|
Bundle size
|
✗
|
✓
|
✓
|
!
|
!
|
|
Performance
|
✗
|
!
|
!
|
✓
|
✓
|
|
Cacheability
|
✗
|
✓
|
✓
|
!
|
✓
|
|
Code-splitting
|
!
|
!
|
!
|
✓
|
✓
|
|
Maintenance
|
!
|
✓
|
✓
|
✓
|
✗
|
Compare styling methods across CSS features, colocation, scaling, debugging, encapsulation, theming, performance, cacheability, code-splitting, and maintenance. section 7.6
Style an application shell
In a Remix expense tracker, add root styles through app/root.tsx or an imported stylesheet, then create a menu component and menu-item component. Extend Remix Link for navigation, highlight the current item, and render logout as a submit button inside a Form rather than as a link. Reuse menu-item styles while preserving the button’s form behavior. section 12.2.1






