css - Border-radius causes weird behaviour in IE9, IE10 and IE11 -
this fiddle produces expected results in real browsers (i tried ff, gc, safari), breaks unexpectedly in ie9, ie10 , ie11. no problems ie7 or ie8.
<div class="root"> top <div class="footer">bottom</div> </div>
.root { background-color: red; position: absolute; height: auto; bottom: 0; top: 0; left: 0; right: 0; margin: 25px; border: 0; border-radius: 7px; overflow: hidden; } .footer { background-color: green; position: fixed; left: 0; bottom: 0; width: 100%; height: 100px; }
if remove border-radius
or overflow:hidden
parent, works fine. on earth have fixed position child? supposed positioned relatively viewport.
is known\documented bug? rationale behind it?
here think happening.
browser vendors seem have decided fixed
position elements overflow have clipping turned off, e.g. not clipped parents. makes things consistent, since fixed
elements positioned relative window, not parent. if clipping applied, have position/width relative window , clipping relative parent. visually look this (except bottom corners should rounded--more on below).
so: fixed
element, no overflow clipping. check.
but changed in ie9. introduced support rounded corners. said rounded clipping. ie9 did right. many browsers right clip square corners, when element has rounded corners. bad. apparently, ie9 fixed detecting presence of rounded corners, , in such cases, re-drawing clipping. when that, makes 2 mistakes.
it applies clipping--undoing "
fixed
element, no overflow clipping" rule. clipping turned on, , element clipped width of parent.the clipping put directly on element, un-centered, no regards fact clipping supposed parent. it's clipped starting @ 0,0 out designated width , height--that's why green element appears left aligned--the right/bottom 50px hidden.
fixes?
- don't nest
fixed
insideabsolute
. (best solution--avoid weird edge-cases in future) - give parent (red) div width.
- nest new
div
directly inside.root
, moveoverflow:hidden
it. fiddle example. (least intrusive)
Comments
Post a Comment