I\'m using CSS box-shadow
to mimic a background that \"bleeds\" to the edges of the browser window. It works great in Chrome, Firefox, Safari, and Internet Exp
Now that we know it's a bug, here's one acceptable workaround:
.widget {
width:600px;
height:400px;
margin:0 auto;
text-align:center;
background:white;
box-shadow:20em 0 0 0 white, -20em 0 0 0 white;
position:relative;
z-index:2;
}
.widget:before, .widget:after {
position:absolute;
content: " ";
width:1em;
left:-1em;
top:0;
height:100%;
background:white;
z-index:1;
}
.widget:after {
left:auto;
right:-1em;
}
Basically, I'm adding absolutely positioned :before
& :after
pseudo elements that contain nothing more than the same background color as the widget
DIV and that DIV's box-shadow
. These pseudo elements are offset just to the outside-left and outside-right of the widget
DIV and positioned behind it so that they provide the correct color for the box-shadow
bleed through.
Obviously this adds complication if one is already using the :before
& :after
elements, but this works for my purposes. I suppose one could also try setting negative margins on the widget
DIV.
Checkout the fiddle here: http://jsfiddle.net/TVNZ2/