Reputation: 9986
here is the page : http://aevm.ca/fond2.html
when i use this css : it's left align and top at zero
#center {
height: 100%;
width: 960px;
position: absolute;
background-color: #FF0;
top: 0px;
margin-right: auto;
margin-left: auto;
}
when i use this css : it's center align and top at 10-20 pixel (WHY?)
#center {
height: 100%;
width: 960px;
position: relative; (the only difference)
background-color: #FF0;
top: 0px;
margin-right: auto;
margin-left: auto;
}
How i can get top position and horizontal center ?
Upvotes: 0
Views: 288
Reputation: 228222
Use position: relative
on #center
.
This is Line 16 of your source code:
<script src="jquery.backstretch.min.js" .. ></script><br>
Get rid of the sneaky <br>
:D
Upvotes: 2
Reputation: 2227
If position is relative
you must type margin-top:0;
Try this;
#center {
height: 100%;
width: 960px;
position: relative; (the only difference)
background-color: #FF0;
margin: 0 auto;
}
Upvotes: 0