TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   XHTML, HTML, CSS (http://www.talkphp.com/xhtml-html-css/)
-   -   body css (http://www.talkphp.com/xhtml-html-css/2367-body-css.html)

bmathers 02-28-2008 10:36 AM

body css
 
i have set the body of my site with a max and min width in the css. However when it is expanded in larger screen it is aligned to the left, how can i keep it centered. The obvious doesnt seem to work?

Any help?

Cheers

Wildhoney 02-28-2008 02:07 PM

Centring a website using purely CSS goes something like so:

css Code:
body
{
    text-align: center;
}

div#container
{

    margin: auto;
    width: 200px;
}

Everything then becomes a descendent of the container DIV.

maZtah 02-28-2008 09:58 PM

And when you only want to have the container horizontally centered do something like this:

CSS Code:
div#container { margin: 0 auto; }
/* The shortened version for margin: 0 auto 0 auto; */


All times are GMT. The time now is 05:59 PM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0