Next.js: Bug CSS in JS with !important rule

Created on 19 Feb 2019  路  3Comments  路  Source: vercel/next.js

Bug report

Describe the bug

can't get CSS in JS with !important working

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Create a div with some style
    <div style={{ margin: "200px", textAlign: "center", width: "100px", height: "100px", border: "1px solid black", background: "red !important" }} > some text </div>
  2. result
    image
  3. when i'm inspect element, style rule for background is gone.
    image
  4. if i remove the !important it works

Expected behavior

style rule is working with !important

System information

  • OS: Windows 10
  • Browser : Chrome Version 72.0.3626.109
  • Version of Next.js: 8.0.0
upstream

Most helpful comment

All 3 comments

You could use github.com/zeit/styled-jsx for this though.

Thanks for the confirmation

Was this page helpful?
0 / 5 - 0 ratings