I am using css grid .I want to show my image using aspect ratio. depending upon width I want to show image .I don't want to give hard corded value of height .is it possible to show image without giving height .?In other words I depending upon width I want to show image without giving any value of height .
here is my code
https://codesandbox.io/s/condescending-flower-m616l?file=/index.html
.abc {
display: grid;
grid-template-columns: repeat(12, 6.697%);
grid-template-rows: 18px repeat(4, 1fr);
border: 1px solid green;
height: 320px;
}
.one {
grid-column: 2/5;
grid-row: 3/5;
border: 1px solid;
}
.two {
grid-row: 1/5;
grid-column: 2/5;
border: 1px solid #ee0;
}
.two div {
max-width: 100%;
/* height: 100%; */
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>Static Template</title>
</head>
<body>
<div class="abc">
<div class="one">
<p>
Lorem ipsum, dolor sit amet consectetur adipisicing elit. Voluptates
culpa iste facaudantium Lorem ipsum,
</p>
</div>
<div class="two">
<div style="background-image: url('hero.png');"></div>
</div>
</div>
</body>
</html>
I am giving /* height: 100%; */
then only my image display ?