I don't know why, but only on my footer with li in inline-block and border-top on active class, my box-sizing : border-box doesn't work.
When the class is active, there are a border-top, and we see a gap on the bottom.
Here an exemple :
* { box-sizing: border-box }
#header{
position:absolute;
top:0;
right:0;
left:0;
background-color:#333c45;
height:60px;
line-height:60px;
}
#corp{
position:absolute;
top:60px;
bottom:60px;
right:0;
left:0;
background-color:#CDCDCD;
}
#footer{
position:absolute;
bottom:0;
right:0;
left:0;
background-color:#333c45;
height:60px;
line-height:60px;
}
#footer li{
display:inline-block;
width:45%;
}
ul{
margin:0;
padding:0;
}
.active{
color:#05FF01;
border-top:2px solid #05FF01;
}
<html>
<head>
</head>
<body>
<div id="header">
test
</div>
<div id="corp">
</div>
<div id="footer">
<ul>
<li class="active">boutton 1</li>
<li>boutton 2</li>
</ul>
</div>
</body>
</html>
How can I solve this problem ?
Thank you !
Add overflow:hidden
to the body. It will prevent any vertical scrollbar.
Also, as a side note, IMO making a layout with every element in position:absolute
is a terrible idea and you'll quickly get headaches.
* {
box-sizing: border-box
}
body {
overflow: hidden;
}
#header {
position: absolute;
top: 0;
right: 0;
left: 0;
background-color: #333c45;
height: 60px;
line-height: 60px;
}
#corp {
position: absolute;
top: 60px;
bottom: 60px;
right: 0;
left: 0;
background-color: #CDCDCD;
}
#footer {
position: absolute;
bottom: 0;
right: 0;
left: 0;
background-color: #333c45;
height: 60px;
line-height: 60px;
}
#footer li {
display: inline-block;
width: 45%;
}
ul {
margin: 0;
padding: 0;
}
.active {
color: #05FF01;
border-top: 2px solid #05FF01;
}
<html>
<head>
</head>
<body>
<div id="header">
test
</div>
<div id="corp">
</div>
<div id="footer">
<ul>
<li class="active">boutton 1</li>
<li>boutton 2</li>
</ul>
</div>
</body>
</html>