I have a page with a header and a content section
------------------
| Header |
------------------
| |
| Content |
| |
| |
------------------
I have used flex: 1 1 auto; overflow:hidden;
on the content and overflow:display; flex: 0 1 auto;
on the header. This all is working fine.
Next in the content i have created 4 <div>
each with 25% height.
<div class="content">
<!--first row-->
<div class="myrow">
<div class="colsolid">Johnson </div><!--
--><div class="col">Coke</div><!--
--><div class="colsolid">Nissan</div><!--
--><div class="col">Pepsi</div>
</div>
<!--second row-->
<div class="myrow">
<div class="colsolid">Johnson </div><!--
--><div class="col">Coke</div><!--
--><div class="colsolid">Nissan</div><!--
--><div class="col">Pepsi</div>
</div>
<!--third row-->
<div class="myrow">
<div class="colsolid">Johnson </div><!--
--><div class="col">Coke</div><!--
--><div class="colsolid">Nissan</div><!--
--><div class="col">Pepsi</div>
</div>
<!--forth row-->
<div class="myrow">
<div class="colsolid">Johnson </div><!--
--><div class="col">Coke</div><!--
--><div class="colsolid">Nissan</div><!--
--><div class="col">Pepsi</div>
</div>
</div>
relevant css
.myrow{
height:25%;
background-color: red;
align-items: center;
border-width: 1px;
border-style: solid;
}
.col{
background-color: green;
display:inline-block;
border-style: solid;
border-width: 1px;
width: -webkit-calc(25% - 2px);
width: -moz-calc(25% - 2px);
width: calc(25% - 2px);
}
.colsolid{
background-color: black;
color: white;
display:inline-block;
border-style: solid;
border-width: 1px;
text-align: center;
width: -webkit-calc(25% - 2px);
width: -moz-calc(25% - 2px);
width: calc(25% - 2px);
}
The issue is that the myrow
are not limiting to be 25% of the content
div. Instead its 25% of the full page height. Any ideas?
Here is the fiddle link