Hi, need ur help..
I make a layout, consist of wrapper box, top box and content box. Top box and content box inside wrapper box.Wrapper is the outer box.Between top box and content box no distance so I set margin-top:0 in #content.Strangely, top and content is overlapping.Content box up some pixel into top box.I attach the image (in Image I align diferently between top and content to see overlapping).
Anything wrong with my CSS ?, please ur help
Here is the HTML code:
<body> <div id="wrap"> <div id="top"></div> <div id="content"></div> </div> </body>
Here is the CSS code:
#wrap{ position:relative; margin:0 auto; padding:0; margin-top:18px; width:850px; height:540px; background-color:#FFF; } #top{ position:relative; padding:0; top:6px; height:68px; width:840px; background-color:#000000; } #content{ margin-left:5px; margin-top:0; height:370px; width:840px; background-color: #006699; }
| Attachment | Size |
|---|---|
| layout.jpg | 5.49 KB |
Remove position:relative;
Remove position:relative; top:6px; from your #top.
You're effectively telling it to occupy its normal space but appear 6px below that point, thats why its over lapping.
Hi Vade,thnx for
Hi Vade,thnx for respond....
with my code,doesn't content box down 6px too? so overlapping not happen.But it doesn't happen, content box stay in its place.Shortly, I want anytime top box down any pixel so does content box, so no overlapping.
thnx
I think you just want a
I think you just want a margin-top:6px on the #top, the #content should sit plush against the bottom of #top.
Is the 6px you want just to have a bit of a border on the top of #top like in your attached image?
Hi Vade, Yes, I just want a
Hi Vade,
Yes, I just want a margin-top:6px on the #top, the #content should sit push against the bottom of #top.
No, there is no border, the white space on top of #top is the result of margin-top:6px in #top.
thx
