Skip to content Skip to sidebar Skip to footer

Background Image Without Specific Height

I'm creating a React page. I want to add a background image that covers the background no matter the window size or resolution etc. so here's what I have for the background. import

Solution 1:

Give viewport height

height:100vh;

Solution 2:

try VH instead of px for height. hope it will work

const BackGroundContainer = styled.div`
background-image: url(${coolImportedImage});background-repeat: no-repeat;background-size:cover;width: 100%;height: 100vh;

`;

Post a Comment for "Background Image Without Specific Height"