views:

57

answers:

2

You can save the code below and try it out.

In firefox,it's full browser grey,but in IE(IE7 to be exact),it's not working.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
<html xmlns="http://www.w3.org/1999/xhtml"&gt;
<head>
<style text="text/css">
.overlay {  
    position:absolute;
    top:0;
    left:0;
    width:100%;
    height:100%;
    z-index:1000;
    background-color:grey;
}
</style>
</head>
<body style="font-size:62.5%;">

<div class="overlay"></div>

</body>
</html>
+4  A: 

IE doesn't recognize the CSS color name grey. Try using a hex color, e.g., #ccc, and it will work. Alternatively, using gray (with an 'a', not an 'e') also works.

Note that this is standards-compliant, because W3C doesn't say anything about supporting alternate spellings of gray, and gray is indeed the color name according to the spec for CSS3.

John Feminella
+1 this is it. Had never noticed that. Beat me to the punch.
Pekka
A: 

Try adding this to your style defs:

html, body {
    height: 100%;
}

On IE, body doesn't extend the full height of the viewport by default, and your overlay's container is body, so...

Edit Just tried it, and yours worked without the above, must be because body is statically positioned. Anyway, John Feminella figured it out; see his answer.

T.J. Crowder