0

I have a file named custom.css which override materialize.css,

It's imported in public/index.html with this line :

<link rel="stylesheet" href="custom.css" />

On a route like /account, it works fine, in the browser I can see the http://localhost:3000/custom.css loaded,

But on a route like /user/:username, the CSS file becomes http://localhost:3000/user/custom.css so it doesn't work,

I did my project with create-react-app, and I'm not using a bundler (maybe there's one with the boilerplate),

I don't even know where to start to resolve this issue,

2
  • How and where do you include your css file ? Commented Jan 7, 2020 at 18:40
  • in public/index.html with this line: <link rel="stylesheet" href="custom.css" />, I don't know how to make it a relative path Commented Jan 7, 2020 at 18:41

1 Answer 1

2

I suppose you use such import path:

<link rel="stylesheet" type="text/css" href="custom.css">

You have to replace path with :

href="/custom.css"
Sign up to request clarification or add additional context in comments.

1 Comment

thank you so much, it works now, i'll accept your answer when i will be able to :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.