I am trying to implement fluid image background for one of my webpage. It works perfectly in Chrome but I can't get it to work in Firefox. I have png images of two squares which will resize proportionally when browser window is resized.
Here's the html:
<html>
<head>
<link rel="stylesheet" type="text/css" href="index.css">
<title>Test Flex</title>
</head>
<body>
<div id="parent_div">
<div id="bluesquare_div"></div>
<div id="yellowsquare_div"></div>
</div>
</body>
</html>
And here's the CSS:
body{
background: #444444;
}
#parent_div{
display: flex;
}
#bluesquare_div{
width: 50%;
background: url("bluesquare.png");
height: 0;
background-size: contain;
background-repeat: no-repeat;
padding-top: 50%;
flex-grow: 1;
}
#yellowsquare_div{
width: 50%;
background: url("yellowsquare.png");
height: 0;
background-size: contain;
background-repeat: no-repeat;
padding-top: 50%;
flex-grow: 1;
}
The problem is I don't see any output in Firefox. If I don't use display:flex
then I can see the two squares in Firefox, but my webpage requires the use of flexbox, so I can't drop it.
Anyone has any idea why its not working in Firefox ?
Here's the screenshot for Chrome version: 55.0.2883.87 m
And here's the screenshot for Firefox version: 50.1.0