Skip to content
Advertisement

Reactjs background image showing only on places with components

I am trying to make a full-screen background image for my website but it does not seem to work. My current code only shows the portion of the background image where components are rendered. I have tried to use background-position: fixed in the App.css file, but the background image becomes full screen but I’m not able to scroll, which is even worse. How do I get this to work?

How my website looks like now:

How my website looks like now.

I tried to set min-width: 100vw and min-height: 100vh but now the top of the webpage is still having the same problem and the webpage becomes scrollable.

Edited webpage:

edited webpage

Below are my files for my App.js and App.css respectively.

JavaScript
JavaScript

Advertisement

Answer

Try this:

JavaScript

or you can set the background image to the <body>

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement