How do I align this to the center of the page? http://jsfiddle.net/WH7Kf/39/
<div id="lower" style="position:fixed; width:95%; height:5%; background-color:green; ">
How do I align this to the center of the page? http://jsfiddle.net/WH7Kf/39/
<div id="lower" style="position:fixed; width:95%; height:5%; background-color:green; ">
You can either do it this way:
margin-left:auto;
margin-right:auto;
Inside your style or you can also use the position
ing property as well:
position:absolute;
top:0%;
left:50%
There isn't a set way to center something, but these are ways that it can be done. Hope this helps!
You can align block-level elements using margin:0 auto;
:
<div id="lower" style="margin:0 auto; width:95%; height:5%; background-color:green; ">
This works because you define the margin on the right and left side to be determined automatically, so it'll be in the very middle of the page.
Here you go.
#lower {
position:fixed;
left:0;
right:0;
width:95%;
height:5%;
background:green;
margin:auto;
}
If you want to make the div get literary centered both vertical and horizontal, add top:0;
and bottom:0;