Andy
Andy

Reputation: 738

Overriding index.html css react project

Hopefully this is an easy one. I am working on a react project (following along with a tutorial). The repo I cloned has a custom css reference that is being applied in my index.html head here:

<link rel="stylesheet" href="//demo.productionready.io/main.css">

I'm curious how to apply a local css file in my project directory so it overrides my external styles as I see fit.

There's a defaul index.css file that is created in my src folder via npx create-react-app. Do I need to be importing this to each react component in order to get it to work?

Thanks!

Upvotes: 1

Views: 1328

Answers (1)

Naim Lasker
Naim Lasker

Reputation: 111

You don't need to modify index.html. You can modify the default index.css file or delete it!

If you want to apply a local css file, import it into your component. Or if you want a global css file, import the css file in App.js, it will work for all components.

import './mycss.css';

Upvotes: 2

Related Questions