Skip to content

Instantly share code, notes, and snippets.

@chriship
Created August 3, 2023 07:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chriship/d564edffd73d4b091ed8a59beff923d0 to your computer and use it in GitHub Desktop.
Save chriship/d564edffd73d4b091ed8a59beff923d0 to your computer and use it in GitHub Desktop.
nextjs Head order bug
@tailwind base;
@tailwind components;
@tailwind utilities;
body {
background-color: green;
}
import Head from 'next/head'
function TestComponent({ }) {
return (
<>
<Head>
<style>{`
body {
background-color: blue;
}
`}</style>
</Head>
<div></div>
</>
)
}
export default function Home() {
return (
<>
<Head>
<style>{`
body {
background-color: red;
}
`}</style>
</Head>
<div>
<TestComponent />
<div>I would expect 'TestComponent' to override the background color but the one from globals.css is prioritized but it rendering green from globals.css</div>
</div>
</>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment