I’m trying to implement the sliding transparent overlay on my sight but I’m having a problem with the positioning of the DIV. When the window is re-sized the div does not retain relativity to the menu items above. Can someone give a pointer as to how this can be achieved?
The yellow box remains relative to the red box but when my window is re-sized I would like the red box to be left align to the window so the users can see easier. A kind of "left align object£ on window re-size. If that makes sense.
It’s a little hard to see exactly what you want as you don’t have much in place for us to work with and what you have in place isn’t developed enough to give a suitable answer.
You have a number of errors in your small snippet of code anyway which we should address first.
#main {
position:float;[B]/* did you mean float:left as there is no position:float property?*/[/B]
background-color: #FF0000;
width: 300px;
Margin-Left:300px;[B]/* should be lower case*/[/B]
}
#second {
position:relative;
background-color: #FFFF00;
padding: 50px;
left: 40px;/* don't use relative positioning to move things around unless you understand why*/
top: 200px;/* "" "/
}
If you want your page to centralise but align left when squeezed then you need to create a page wrapper at the width that you want the layout to be and then centred with auto margins.
e.g.
#outer{
width:960px;
margin:auto;
}
You would then place your content inside this container as required.
I think it may be better for you to first work on the basics before jumping straight into a complicated layout as you need to understand how all these things fit together.