JS Bin
// source https://jsbin.com/badepozoko
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<style id="jsbin-css">
html,body{
margin: 0;
padding: 0;
}
.container{
}
.container div{
float: left;
width: 25%;
height: 0;
padding-top: calc(12.5% - 1px);
padding-bottom: calc(12.5% - 1px);
box-sizing: border-box;
border: 1px solid red;
display: flex;
align-items: center;
justify-content: center;
}
</style>
</head>
<body>
<div class="container">
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
<div>7</div>
<div>8</div>
<div>9</div>
<div>10</div>
<div>11</div>
<div>12</div>
<div>13</div>
<div>14</div>
<div>15</div>
<div>16</div>
</div>
<script id="jsbin-source-css" type="text/css">html,body{
margin: 0;
padding: 0;
}
.container{
}
.container div{
float: left;
width: 25%;
height: 0;
padding-top: calc(12.5% - 1px);
padding-bottom: calc(12.5% - 1px);
box-sizing: border-box;
border: 1px solid red;
display: flex;
align-items: center;
justify-content: center;
}</script>
</body>
</html>
html,body{
margin: 0;
padding: 0;
}
.container{
}
.container div{
float: left;
width: 25%;
height: 0;
padding-top: calc(12.5% - 1px);
padding-bottom: calc(12.5% - 1px);
box-sizing: border-box;
border: 1px solid red;
display: flex;
align-items: center;
justify-content: center;
}