Is it possible to use border-radius on a div (in Chrome and Opera) so that the inner div background would also be affected? If not, how else can this effect be achieved?
Example: http://jsfiddle.net/fE58b/1/
It works well in IE9 & FF7.
Thank you.
Is it possible to use border-radius on a div (in Chrome and Opera) so that the inner div background would also be affected? If not, how else can this effect be achieved?
Example: http://jsfiddle.net/fE58b/1/
It works well in IE9 & FF7.
Thank you.
It works if you just move the background image from #content
to .box
:
.box {
background:url(...so_70s_background.jpg) top left repeat;
}
Also if you really need to have the borders in a separate div, you can always add new divs outside the box:
<div class="box-outer">
<div class="box">
<div id="content"></div>
</div>
</div>
Just make sure to apply:
.box-outer {
width:500px;
height:500px;
position:absolute;
}
So, as Cristi stated above, some browsers seem to have a little trouble with clipping overflowing children along the curved border of their parents. It appears that, in order (for at least Webkit) to render child overflow affected by parent border-radius, both parent and child must be statically positioned.
Furthermore, even with this static positioning, it appears that setting an opacity value for the child element will cause it to break the overflow boundaries of its parent (if I had to guess, I'd imagine this has something to do with the opacity value triggering hardware accelerated graphics, in which case a 3D-transform will produce the same glitch).
Luckily, you can use an absolutely-positioned grandparent control the dimensions and position of its static children, and rgba
on background and text to simulate element opacity. I just so happen to have a jsfiddle snippet demonstrating some of these workarounds which you might find helpful.
user following to solve border radous issue
border-radius: 20%; /* FOR ALL NEW BROWSER OF HIGHER VERSION*/
-webkit-border-radius: 20%; *FOR ALL OHTER OLD BROWSER*/
-moz-border-radius: 20%; /* FOR MOZILLA FF*/