Click here to Skip to main content
15,886,780 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
I want the background to cover the page and show as one unified picture.

What I have tried:

If I put

background-repeat: no repeat;
background-size: cover;
then the image shows in the top left corner and does not cover the whole page. If I take out the background-repeat attribute, the picture repeats itself but covers the entire page. How do I solve this? Thanks in advance.
Posted
Updated 20-Feb-20 0:29am
Comments
Richard Deeming 1-Jun-17 12:06pm    
background-size:cover should scale the image up to cover the background of the entire element. If it's not working, then there's something else going on:

* Are you using a browser which supports the property?
* Is your element big enough to cover the whole page?
* Is there another rule overriding the background-size property?

 
Share this answer
 
use background-size property and its value as percentage
apply bellow code

background-repeat: no repeat;
background-size: 100% 100%;
background-attachment:fixed;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900