- Sold between 50 000 and 100 000 dollars
- Author was Featured
- Author had a Free File of the Month
- Exclusive Author
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Europe
- Has been a member for 3-4 years
- Referred between 10 and 49 users
This is my code:
<div id="circle">
<div id="inner"></div>
</div>
#circle{
position:relative;
display:block;
width:100px;
height:100px;
background:black;
border-radius:50px;
-moz-border-radius:50px;
-webkit-border-radius:50px;
overflow:hidden;
}
#inner {
position:absolute;
width:100px;
height:30px;
background:yellow;
top:0px;
left:0px;
}
I am trying to achive the first picture, and it works in FF and IE9 , but fails in Safari, Chrome and Opera where I get second picture.
![]()
Is there a way to make this cross browser?
Thank you
This is a known bug in Webkit, and also seems Opera is affected by it. I found this thread in Stackoverflow where it was discussed: http://stackoverflow.com/questions/6144398/rounded-corners-fail-to-cut-off-content-in-webkit-browsers-if-positionrelative
The solution is to remove the position relative declaration form the outer container. You have to position the inner element using margins then. This then works as intended in Webkit, but sadly not in Opera. Hopefully all browsers will fix this bug soon.
- Sold between 50 000 and 100 000 dollars
- Author was Featured
- Author had a Free File of the Month
- Exclusive Author
- Repeatedly Helped protect Envato Marketplaces against copyright violations
- Europe
- Has been a member for 3-4 years
- Referred between 10 and 49 users
Thanks for the reply!
So in other words this cant be done?
I dont even want to ask about IE7 and 8 
It seems that there is no fix for it, at least not for Opera. It will work in Firefox, IE9 and also in Webkit if you remove the position relative declaration.
IE7 and 8 does not support border radius, so no need to worry there 
