View Full Version : Cover Up

07-21-2007, 03:52 PM
I want a div with a black background to cover the whole window and any content that may be in that area, how would i do that? The idea is that i can then write some java scrip to show and hide this div. Thanks Phill

07-21-2007, 05:43 PM
<style type="text/css">
* { margin: 0; padding: 0; }
#hide { width: 100%; height: 100%; background-color: #000; }

<div id="hide">&nbsp;</div>

07-21-2007, 06:08 PM
div { position: absolute; /* or fixed */ width: 100%; height: 100%; }

If you want to be able to use padding and borders on the outer div element, you need to use offsets. Offsets are not properly supported by Internet Explorer 6.

div { position: absolute; /* or fixed */ top: 0; left: 0; right: 0; bottom: 0; }

07-21-2007, 11:37 PM
that works, to fill the window that is, but if you scroll, you can see part of the page at the bottom.

07-21-2007, 11:40 PM
Can you tell us exactly what it is that you are trying to do?

07-21-2007, 11:45 PM
Can you tell us exactly what it is that you are trying to do?

something similar to light box, for an example see http://www.avon-tyres.co.uk/motorcycle/?page=tyres&method=showtyre&id=6

click one of the wheels

07-21-2007, 11:58 PM
Okay then why not use lightbox or thickbox?

07-22-2007, 12:36 AM
because thats too easy :-) . I like learning new techneques and i find the best way is to emulate something. I know i may be trying to re-invent the wheel, but thats the way i like it.

07-22-2007, 12:55 AM
Its just as easy as going to a forum and asking how to accomplish something similar. I don't see the point. To recreate something like lightbox you would need to have a strong knowledge of javascript prototype as well as scriptaculous. for a beginner like yourself it can be cumbersome.