Skip to content
Advertisement

Tag: http-status-code-404

I am getting a 404 error when attempting to load a background-image from CSS. Unsure how to proceed

I have searched through several posts regarding this same issue but none seem to resolve my problem. I am getting this 404 error in my console: index.css:1 GET http://localhost:5500/assets/css/assets/css/Battleship-Wallpaper.jpeg 404 (Not Found) I have the image saved in .jpeg format inside of my CSS folder. I am attempting to link the relative path and set the background image like so:

404 page in REACT

I created the component NotFound and it works fine when I go to a page that doesn’t exist. But the same page it’s appearing in all my pages, not only the one that doesn’t exist. This is the component: And this is how I used it in the main page: As you can see I use <Route path=”*” component={NotFound} />

react.js Replace img src onerror

I have a react component that is the detail view from a list. I am trying to replace the image with a default image if the image does not exist and there is a 404 error. I would normally use the onerror method in the img tag but that doesn’t seem to be working. I am not sure how to

Advertisement