Div Background image disappears

Rakesh

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.

mega6382

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.

edited at
0

Comments

0 comments
Login to comment

Related

TOP Ranking

HotTag

Archive