I have 3 nested divs:
<div class="outer">
<div class="inner"><div class="item"></div></div>
</div>
The .inner div is position absolute and they each have 1px border:
.outer{
width:50%;
height:100px;
border: 1px solid red;
position:relative;
overflow-x:hidden;
box-sizing:border-box;
}
.inner{
border:1px solid blue;
height:100%;
position: absolute;
box-sizing: border-box;
}
.item{
width:100px;
height:100%;
background-color:yellow;
display: inline-block;
border:1px solid green;
box-sizing:border-box;
}
This arrangement results in a scrollbar on the .outer div.
Here's a codepen
Why is this and what do I need to change to stop it happening?
If the width of the border of the .inner div is increased to 3px then the scrollbar goes away. Again, why is this happening?