Web ページの 1 つに流動的な画像の背景を実装しようとしています。Chrome では問題なく動作しますが、Firefox では動作しません。ブラウザウィンドウのサイズが変更されると、比例してサイズが変更される2つの正方形のpng画像があります。
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>
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;
}
問題は、Firefox で出力が表示されないことです。使用しない場合display:flex
、Firefox で 2 つの四角が表示されますが、私の Web ページでは flexbox を使用する必要があるため、ドロップできません。
Firefox で動作しない理由を知っている人はいますか?
Chrome バージョンのスクリーンショットは次のとおりです: 55.0.2883.87 m
Firefox バージョンのスクリーンショットは次のとおりです: 50.1.0