Reputation: 21
Why does IE11 set a wrong size for a fixed positioned element? When his parent has a relative position with exactly defined size with a border-radius and hidden overflow, then the fixed element takes the size of his parent and not its own.
Example:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="de-CH" lang="de-CH">
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>Fixed Test</title>
<style>
div {
position: relative;
overflow: hidden;
min-height: 100px;
width: 200px;
border-radius: 5px;
background-color: green;
}
.fixed {
position: fixed;
top: 0;
left: 0;
height: 100%;
width: 100%;
z-index: 1000;
background-color: red;
}
</style>
</head>
<body>
<div><span onclick="this.className='fixed'">click me</span></div>
</body>
</html>
Upvotes: 2
Views: 1386
Reputation: 8620
When I compared this behavior to Chrome, the key here seems to be overflow: hidden
. There could be something specific about this in the spec, but I think IE might be in the right here, at least partially. When I tried, the fixed span took the width and height of the whole viewport, but was masked by its containing div's overflow attribute - removing that made the whole screen red.
However, it still turned the upper left corner into a straightedge, which seems to be incorrect.
Upvotes: 1