As I mentioned before link you can use display: flex
and if you need to run in old browsers use display: table
html, body {
margin:0;
padding:0;
height: 100%;
}
.container {
height: 100%;
display: flex;
flex-direction: column;
}
.container > .row {
flex: 1; /*faz prencher*/
display: flex;
height: 100%;
background: #fc0;
flex-direction: row;
}
.container > .row > .item {
flex: 1; /*faz prencher*/
width: 25%;
}
.container > .row > .item > a {
display: block;
overflow: hidden;
width: 100%;
height: 100%;
}
.container > .row > .item > a img {
display: block;
min-width: 100%;
min-height: 100%;
}
<div class="container">
<div class="row">
<div class="item">
<a href="#"><img src="http://i.stack.imgur.com/YM5Wu.png"></a></div><divclass="item">
<a href="#"><img src="http://i.stack.imgur.com/0YjCm.png"></a></div><divclass="item">
<a href="#"><img src="http://i.stack.imgur.com/YM5Wu.png"></a></div><divclass="item">
<a href="#"><img src="http://i.stack.imgur.com/0YjCm.png"></a></div></div><divclass="row">
<div class="item">
<a href="#"><img src="http://i.stack.imgur.com/0YjCm.png"></a></div><divclass="item">
<a href="#"><img src="http://i.stack.imgur.com/YM5Wu.png"></a></div><divclass="item">
<a href="#"><img src="http://i.stack.imgur.com/0YjCm.png"></a></div><divclass="item">
<a href="#"><img src="http://i.stack.imgur.com/YM5Wu.png"></a></div></div><divclass="row">
<div class="item">
<a href="#"><img src="http://i.stack.imgur.com/YM5Wu.png"></a></div><divclass="item">
<a href="#"><img src="http://i.stack.imgur.com/0YjCm.png"></a></div><divclass="item">
<a href="#"><img src="http://i.stack.imgur.com/YM5Wu.png"></a></div><divclass="item">
<a href="#"><img src="http://i.stack.imgur.com/0YjCm.png"></a></div></div></div>
Usingdisplay:table
forolderbrowsers(PS:Ihavenotbeenabletoadjustthewidththatexceeds100%,butI'mtryingtofixitandI'malreadyeditingagain):
html, body {
margin:0;
padding:0;
height: 100%;
}
.container {
display: table;
max-width: 100%;
width: 100%;
height: 100%;
}
.container > .row {
display: table-row;
width: 100%;
}
.container > .row > .item {
background: #fc0;
display: table-cell;
width: 25%;
}
.container > .row > .item > a {
display: block;
overflow: hidden;
width: 100%;
height: 100%;
}
.container > .row > .item > a img {
display: block;
min-width: 100%;
min-height: 100%;
}
<div class="container">
<div class="row">
<div class="item">
<a href="#"><img src="http://i.stack.imgur.com/YM5Wu.png"></a></div><divclass="item">
<a href="#"><img src="http://i.stack.imgur.com/0YjCm.png"></a></div><divclass="item">
<a href="#"><img src="http://i.stack.imgur.com/YM5Wu.png"></a></div><divclass="item">
<a href="#"><img src="http://i.stack.imgur.com/0YjCm.png"></a></div></div><divclass="row">
<div class="item">
<a href="#"><img src="http://i.stack.imgur.com/0YjCm.png"></a></div><divclass="item">
<a href="#"><img src="http://i.stack.imgur.com/YM5Wu.png"></a></div><divclass="item">
<a href="#"><img src="http://i.stack.imgur.com/0YjCm.png"></a></div><divclass="item">
<a href="#"><img src="http://i.stack.imgur.com/YM5Wu.png"></a></div></div><divclass="row">
<div class="item">
<a href="#"><img src="http://i.stack.imgur.com/YM5Wu.png"></a></div><divclass="item">
<a href="#"><img src="http://i.stack.imgur.com/0YjCm.png"></a></div><divclass="item">
<a href="#"><img src="http://i.stack.imgur.com/YM5Wu.png"></a></div><divclass="item">
<a href="#"><img src="http://i.stack.imgur.com/0YjCm.png"></a></div></div></div>
Thismakestheimagesfillthecontents,butifyouwantafillfromthecenter,youwillhavetoremovetheimagesandusebackground,forexample: