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.

firefox on left , ie9-ie11 on right

<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.

  1. it applies clipping--undoing "fixed element, no overflow clipping" rule. clipping turned on, , element clipped width of parent.

  2. 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 inside absolute. (best solution--avoid weird edge-cases in future)
  • give parent (red) div width.
  • nest new div directly inside .root , move overflow:hidden it. fiddle example. (least intrusive)

Comments

Popular posts from this blog

plot - Remove Objects from Legend When You Have Also Used Fit, Matlab -

java - Why does my date parsing return a weird date? -

Need help in packaging app using TideSDK on Windows -