mrab
asked on
how do i center layers so that they are always in the middle of any screen?
I have centered layers on a website - but on a widescreen computer the layers move to the left.
What coding do i place to ensure that all layers a re centered on any screen?
What coding do i place to ensure that all layers a re centered on any screen?
ASKER
What if I want to get layer middle of the sreen but just horizontal?
eg if it were a Banner?
eg if it were a Banner?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
<div id="main">
test
</div>
css example
#main
{
position: absolute;
top:50%;
left: 50%;
margin-top: -250px; /* make this half your image/element height */
margin-left: -450px; /* make this half your image/element width */
height: 500px;
width: 900px;
display: table;
vertical-align: middle;
border: 1px solid #7D5700;
}