I'm trying to set an image to stretch across the entire landing page in React.js. I've tried using div tags and having corresponding class names in the css to set this attribute, but am only getting a small section of the page to be the image rather than the whole page:
I'd like for the image to cover the entire page with no white spaces.
This is my .css
.start-bg {
margin: 0;
padding: 0;
background: url("./images/movierama.jpeg") no-repeat center fixed;
background-size: cover;
min-width: 100%;
min-height: 100%;
}
This is my React.jsx file:
<div className="start-bg">
<h1 className="landing">
Welcome to Movierama!
<p>Explore our movie collection today!</p>
</h1>
<Link to="/">
<button
className="btn btn-primary"
>
Enter
</button>
</Link>
</div>
Bonus: I'm trying to center the button too, but it's not working with the css tags I'm applying. Help appreciated.
Thanks!!

min-height: 100%tomin-height: 100vh. That should get it to be at least the height of the viewport, but it looks like you also have content or a margin keeping it away from the top of the viewport, which might be a separate issue. Another option would be to set a class on body when your component mounts using the DOM api.min-height: 100%to html, body to ensure that the document always fills the viewport.