Jump to content

centralized webpage


marquis

Recommended Posts

There is so many threads on this and i beleive the generally accepted way is to do this.CSS:

body{text-align:center}.container{position:relative;margin: 0 auto;}

html:

<html><head><link type="text/css" rel="stylesheet" href="stylesheet.css" /></head><body><div class="container">YOUR WEBSITE HERE</div></body></html>

replace stylesheet.css with the location of your stylesheet.I beleive this is correct unless someone knows otherwise.

Link to comment
Share on other sites

umm...in risk of offending everyone..you're all wrong :)You need to do this:Make an outer div<html><head></head><body><div class="outer"><!-- the rest of the page here --></div></body></html>Then the CSS will be:.outer{margin:auto;}its that simple:blink:edit - seems roondog posted at the same time..but mines much simpler and works in the same way :) :)

Link to comment
Share on other sites

I actually use

.container{margin-left: auto;margin-right auto;}

but i've seen alot of people post the other way.

Link to comment
Share on other sites

but real_illusions what about IE!? You know how IE loves margin: 0 auto;? This won't align center in IE but it will in FF, NN and opera...Correct way again lolHTML

<html><body><div id="container"><!-- Rest of page in here --></div></body></html>

CSS

body { text-align: center; } // centers div in IE#container { text-align: left; margin: 0 auto; } // left align text in div and centers in other browsers

Thank you come again :)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...