I tried to make some kind of a gallery made out of blocks. So I searched for the question: "How to set height equal to width". After trying it out it worked. But the method they explained was the famous 'pading-bottom in % = width in %'
. And of course since there is a padding my image can't be placed inside the box.
Is there a way to place the image inside the box?
If any of you know the answer or another method, please let me know.
.imagebox{
border: 1px solid red;
width:25%;
padding-bottom:25%;
float:left;
}
<!DOCTYPEhtml>
<html>
<head>
</head>
<body>
<div class="imagebox">
<img src="">
</div>
<div class="imagebox">
<img src="">
</div>
<div class="imagebox">
<img src="">
</div>
</body>
</html>