I am developing my site and would like to center the entire template in the page. I have seen other templates that are centered but for the life of me cant seem to find an easy way to do it. Any help is much appreciated.
I am developing my site and would like to center the entire template in the page. I have seen other templates that are centered but for the life of me cant seem to find an easy way to do it. Any help is much appreciated.
Create a container for everything inside <body> then center that.
<body>
<div id="container">
.
.
.
.
</div>
</body>
#container {
margin: 0 auto
}
Tried that ?
Wouldn't this work rather than the div?
body { margin: 0 auto }
Actually - isn't an IE statement needed ?
Something like
body {
text-align:center
}
div {
margin: 0 auto
}
Yes, and what a crippling hassle it all is when it doesn't make any sense! A good case for hand coding document style as opposed to using something like DreamWeaverwhich shows you such pretty pages, and then you panic and cry when they are displayed in IE (or any other browser sometimes.)
for the body:
body {
margin: 0 auto;
padding: 0 auto;
text-align: center;
}
For the container:
div.container {
width: state width in pixels
margin: 0 auto;
}
However, this doesn't always work... sadly I've found that sometimes a left margin is required to place sub div containers in the right place.
This topic has been closed to new replies.