I have the following HTML and CSS
<div id="box1">
<div id="box2"></div>
</div>
#box1 {
position: absolute;
top: 10px;
left: 10px;
width: 200px;
height: 85px;
background: blue;
overflow-y: hidden;
overflow-x: visible;
}
#box2
{
width: 100px;
height: 100px;
border-radius: 50%;
background: red;
position: absolute;
bottom: 0px;
right: -5px;
}
I'm trying to achieve an effect where the #box2
is positioned partly outside of #box1
. I want the overflow out of the top and bottom of #box1
to be hidden
but the overflow left and right to be visible
.
However when I set overflow-y: hidden
on the container #box1
, it seems to set overflow-x
to scroll/auto behaviour. I don't want any scrolling I just want the overflow to be visible. Does anyone know how to do this?
Here is a demo of the problem.
There are some similar question that have been asked on SO but the solutions to those questions didn't really apply to my scenario