Forum Moderators: not2easy
<div id="content">
<h1>Top of the text content</h1>
<p>enter loads of filler text - <a href="#">text a link for clickability</a></p><p>enter loads of filler text</p><p>enter loads of filler text</p><p>enter loads of filler text</p>
<h3>You have reached the bottom of the text</h3>
</div>
<div id="window">
<div id="otop"><!-- the whole top effect --></div>
<div id="oleft"><!-- contains the full width side effect --></div>
<div id="oright"><!-- contains the full width side effect --></div>
<div id="obot"><!-- contains the bottom effect --></div>
</div>
html, body {padding: 0; margin: 0;}
body {
color: #000;
background: #0f0 url(image.png) fixed 50% 50%;
min-width: 500px;
}
#window { /* it's really a fake window, only used for anchoring it's surrounding divs */
width: 500px;
height: 300px;
position: fixed; /* to stop the anchored divs moving with content */
left: 50%;
top: 50%;
margin-left: -250px;
margin-top: -150px;
z-index: 2; /* must be higher than the content div */
pointer-events: none; /* or FF doesn't click through fake window overlay */
}
#otop, #obot, #oleft, #oright {
/* these all nested inside the fake div take their position from it */
position: absolute;
}
#otop {
background: #00f;
width: 1280px;
height: 200px; /*width and height dimension should equal your overall effect size */
top: 0; /* top left corner of fake window */
left: 50%; /* to find center */
margin-left: -640px; /* half the width */
margin-top: -200px; /* should be negative the same as the height of your top image effect it's starting at 0 so just needs pushed up */
}
#obot {
background: #00f;
width: 1280px;
height: 200px; /*width and height dimension should equal your overall effect size */
left: 50%;
bottom: 0; /*bottom left corner*/
margin-left: -640px;
margin-bottom: -200px; /* should be negative the same as the height of your bottom image effect it's starting at 0 so just needs pushed down */
}
#oleft {
background: #0ee;
height: 300px; /* same as window height */
width: 390px;
top: 0;
left: 0;
margin-left: -390px; /* move off to the left by its full width */
}
#oright {
background: #0ee;
height: 300px; /* same as window height */
width: 390px;
top: 0;
margin-left: 100%; /* position starting from the right side, either left or margin-left should do it */
}
#content {
/*keep background transparent, and use the body background*/
position: absolute;
z-index: 1; /* must be lower than the fake window */
width: 480px; /* window width - bit for "padding" */
height: 280px; /* window height minus a bit for "padding" */
overflow: visible; /* default but just here to clarify */
left: 50%; top: 50%; /* find it's center */
margin-left: -240px; /* move it left by half the width */
margin-top: -140px; /* move it up by half the window height */
/* IE hack as padding didn't work for Firefox, see #content:after for it*/
*padding-bottom: 200px; /* maximum needed for text to clear height of bottom div, this will be too much if windowed is narrowed */
}
#content:after { /* create the extra padding works in modern browsers so only ie7 and below need the padding hack above */
content: " ";
display: block;
height: 200px;
}
#content p {line-height: 150px;} /* just to fill out the area quickly */