Skip to content

Instantly share code, notes, and snippets.

@vre2h
Last active May 21, 2024 20:54
Show Gist options
  • Save vre2h/4bad1d3b836f6a18c9bd5a8ca68ab1d9 to your computer and use it in GitHub Desktop.
Save vre2h/4bad1d3b836f6a18c9bd5a8ca68ab1d9 to your computer and use it in GitHub Desktop.
Simple guide to adding normalize.css to create-react-app
  1. Install normalize.css via npm
npm install --save normalize.css

1.1 Or yarn

yarn add normalize.css
  1. Import it to your root .js file before your css styles
import 'normalize.css';
@jitchie
Copy link

jitchie commented Sep 19, 2021

Unknown rule for normalize seems to be a recurring theme.
There are some work-arounds:

facebook/create-react-app#9710 (comment)

about to try this.

goodluck x

@arjang-psh
Copy link

hoe can i import it if I use Styled components?

@whossein
Copy link

whossein commented Jul 1, 2022

i write @import-normalize; but not worked!

@YuriyIzyurov
Copy link

YuriyIzyurov commented Jul 7, 2022

It doesn't work, Ant design styles is above normalize.css

@skillwork-mdimitrov
Copy link

skillwork-mdimitrov commented Aug 26, 2022

Just import this inside the index.css:

@import-normalize;

https://create-react-app.dev/docs/adding-css-reset/

I got this error when using above code in index.css

Unknown at rule @import-normalize css(unknownAtRules)

I also have the same IDE error but it does work for me at least.
When I inspect an element in the Dev tools it detects and applies the normalization

@theitaliandev
Copy link

theitaliandev commented Oct 19, 2022

Just import this inside the index.css:

@import-normalize;

https://create-react-app.dev/docs/adding-css-reset/

I got this error when using above code in index.css

Unknown at rule @import-normalize css(unknownAtRules)

Tip: If you see an "Unknown at rule @import-normalize css(unknownAtRules)" warning in VSCode, change the css.lint.unknownAtRules setting to ignore

Directly from https://create-react-app.dev/docs/adding-css-reset

@OtlichnikSasha
Copy link

use @import "normalize.css/normalize.css" instead @import-normalize;

@mrsvolodya
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment