6
votes

I stumbled on something weird with IE10 and IE9, not affecting IE8: a "position: fixed" child element is hidden when the border-radius, overflow and position of its parent are set (cf. the jsfiddle example). If one of these properties is disabled, the fixed element appears.

I put a live example at http://jsfiddle.net/arkhi/7Nydz/.

<div style="position:relative; border-radius:5px; overflow:hidden;">
    <a style="position:fixed">fixed child</a>
</div>
  1. Ideally, all red boxes should appear at the bottom right of the page, from right to left.
  2. On IE9 and IE10, the first box is hidden.
  3. If one does a "select all" then click somewhere on the page, it happens that the first box appears.

I would like to know if anybody have any explanation or link explaining this bug (if this is a bug and not me not seeing the obvious).

Thanks a lot for any feedback on this!

3
I can confirm this also happens in IE11. And I'm guessing the reason it doesn't affect IE8 is that IE8 doesn't support border-radius.Spudley
Thanks for the heads up about IE11. I still hope to get an answer here or on MS bugtracker.arkhi

3 Answers

2
votes

In the absence of an useful answer from anyone else, the only way I've managed to work around this is to add an additional nested element, and split the three affected styles across two layers.

<div>      //style with position:fixed
  <div>    //style with overflow:hidden and border-radius
    ....
  </div>
</div>

It's not ideal, but it does work around the problem.

To prove it works, here's your jsFiddle with the change made to test-1: http://jsfiddle.net/7Nydz/2/

1
votes

Seems to be a common issue:

Fortunately, there is a quick and dirty solution: simply place an empty un-positioned static <div></div> immediately before and/or after the absolutely-positioned element. In the fixed example, an empty <div></div>after the header prevents the problem occurring.

Semantic HTML devotees will be horrified but I’m afraid there doesn’t appear to be a CSS-only fix … unless anyone knows otherwise?

http://www.sitepoint.com/fix-disappearing-absolute-position-element-ie/

0
votes

So this is just an idea and I cant test it because I'm on a Mac and dont have a Windows machine at hand right now. But have you tried to use a clearfix on the fixed element? This will cause the browser to handle the element differently and display something additional after it. With some luck it might show up?

It probably doesn't work but sometimes weird things happen.