Reputation: 11888
I have the following html :
<div class="container-fluid" style="height: 80px;">
<div class="row">
<div class="component">
...
</div>
</div>
</div>
how can I have my component having the same height as my container ? I could set height: inherit;
on both the row and the component but I was wondering if there was any other way.
Upvotes: 2
Views: 80
Reputation: 229
You can also use Flexbox. I added border color to make the boundaries visible.
<div class="container-fluid">
<div class="row">
<div class="component">
...
</div>
</div>
</div>
.container-fluid {
height: 80px;
border: 1px solid black;
}
.row {
height: 100%;
text-align: center;
display: -webkit-box;
display: -webkit-flex;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
}
.component {
border: 1px solid red;
}
https://jsfiddle.net/m655owr8/5/
Upvotes: 2
Reputation: 362780
You could use the same CSS class on all three..
<div class="container-fluid equal">
<div class="row equal">
<div class="component equal">
...
</div>
</div>
</div>
.equal {
height: 80px;
}
Upvotes: 2