Reputation: 68
I have a row with three columns that have a size of 10% 80% 10% respectively, but when I view the page the player
column is larger than the slider
column. I don't understand why because the column player
and slider
have the same size but are rendered different. when I open the inspection I see that the sum of the values of the heights of the single 3 columns exceeds the height of the body of the document.
html {
height: 100%;
}
body {
height: 100%;
overflow-y:hidden;
}
body {
font-family: 'Muli', sans-serif;
}
.navbar-brand {
height:10%;
}
.container-fluid {
height: 100%;
padding-left: 0px;
padding-right: 0px;
overflow: hidden;
}
.row {
margin-left: 0px;
margin-right: 0px;
overflow: hidden;
}
.row-first {
height:70%;
overflow: hidden;
}
.row-full-height {
height:100%;
overflow: hidden;
}
.full-width
{
width:100%;
overflow: hidden;
}
.height20p{
height:20%;
overflow: hidden;
}
.row-second {
height:30%;
overflow: hidden;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<a class="navbar-brand" href="#">JS</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse w-100 justify-content-center" id="navbarSupportedContent">
<ul class="navbar-nav mx-auto">
<li class="nav-item">
<a class="nav-link" href="#">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Contact</a>
</li>
</ul>
</div>
</nav>
<div class="container-fluid">
<div class="row no-gutters" style="height:100%" >
<div class="col-sm-2" style="background-color: rgb(105, 128, 0)"> 1 </div>
<div class="col-sm-7" style="background-color: rgb(240, 144, 1)"> <!-- contiene player 3d, slider --->
<div class="row no-gutters" style="height:100%" >
<div class="col-sm-12" style="background-color: rgb(128, 0, 21); height:10%"> player </div>
<div class="col-sm-12" style="background-color: rgb(78, 59, 82); height:80%"> 3d </div>
<div class="col-sm-12" style="background-color: rgb(115, 139, 117); height:10%"> slider </div>
</div>
</div>
<div class="col-sm-3" style="background-color: rgb(230, 64, 14)"> 4 </div>
</div>
</div>
Upvotes: 0
Views: 47
Reputation: 2272
That is because your container-fluid
has height:100%
, making it gets the page's height. To fix that you have to discount the navbar
height in the container-fluid's height.
height: calc(100% - 56px);
html {
height: 100%;
}
body {
height: 100%;
overflow-y:hidden;
}
body {
font-family: 'Muli', sans-serif;
}
.navbar-brand {
height:10%;
}
.container-fluid {
height: calc(100% - 56px);
padding-left: 0px;
padding-right: 0px;
overflow: hidden;
}
.row {
margin-left: 0px;
margin-right: 0px;
overflow: hidden;
}
.row-first {
height:70%;
overflow: hidden;
}
.row-full-height {
height:100%;
overflow: hidden;
}
.full-width
{
width:100%;
overflow: hidden;
}
.height20p{
height:20%;
overflow: hidden;
}
.row-second {
height:30%;
overflow: hidden;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
<nav class="navbar navbar-expand-lg navbar-dark bg-primary">
<a class="navbar-brand" href="#">JS</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="navbar-collapse collapse w-100 justify-content-center" id="navbarSupportedContent">
<ul class="navbar-nav mx-auto">
<li class="nav-item">
<a class="nav-link" href="#">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Contact</a>
</li>
</ul>
</div>
</nav>
<div class="container-fluid">
<div class="row no-gutters" style="height:100%" >
<div class="col-sm-2" style="background-color: rgb(105, 128, 0)"> 1 </div>
<div class="col-sm-7" style="background-color: rgb(240, 144, 1)"> <!-- contiene player 3d, slider --->
<div class="row no-gutters" style="height:100%" >
<div class="col-sm-12" style="background-color: rgb(128, 0, 21); height:10%"> player </div>
<div class="col-sm-12" style="background-color: rgb(78, 59, 82); height:80%"> 3d </div>
<div class="col-sm-12" style="background-color: rgb(115, 139, 117); height:10%"> slider </div>
</div>
</div>
<div class="col-sm-3" style="background-color: rgb(230, 64, 14)"> 4 </div>
</div>
</div>
Upvotes: 1