Skip to content

Why does Geist take precedence over globals.css in next.js #523

Answered by unix
Ashinch asked this question in Q&A
Discussion options

You must be logged in to vote

To ensure that the answers can be searched and referenced by others in the community, here are the answers in English.

The reason for this issue is that the styles generated by CssBaseline are appended to the head as style tags (<style> ... </style>), if your Global Styles generates link tags after bundle, then your Global Styles priority will be lower than the CssBaseline.

Solutions (choose one of them)

  • The simplest way is to use a JSS solution such as styled-jsx (always preferentially introduced using tags):
<style global jsx>{` global css `}</style>
  • Specify that your Global Style files are NOT extracted when using bundle tools like webpack. (ensure that Global styles are inline)
  • U…

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
1 reply
@Ashinch
Comment options

Comment options

You must be logged in to vote
1 reply
@Ashinch
Comment options

Answer selected by ofekashery
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants