Hi I am trying to add a image as background to a div. it works when window is maximized, but when i change the size of the window, the image disappears.
Can you please let me know where i am going wrong.
background-image: url('../Images/IPCC-Tile.jpg');
background-color: #FFFFFF;
background-repeat: no-repeat;
background-position: center center;
position: absolute;
width: 15%;
height: 35%;
top: 30%;
left: 2%;
overflow:visible;
thank you.
This should work:
background-image: url('../Images/IPCC-Tile.jpg');
background-color: #FFFFFF;
background-repeat: no-repeat;
background-position: center center;
background-size:contain;
position: absolute;
width: 15%;
height: 35%;
top: 30%;
left: 2%;
overflow:visible;
Set the value of background-size
to cover
or contain
, it doesn't matter.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments