This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Stylesheets > May 2005 > center align a <div> element





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author center align a <div> element
bissatch@yahoo.co.uk

2005-05-29, 11:24 pm

Hi,

I have the following page:

www.martynbissett.co.uk/index_div.html

It is very basic that all elements will be structured using <div> tags
and CSS styles will define the layout. What I dont know how to do is
align the wrapper <div> (#maindiv) center. How is this done?

Cheers

Burnsy

logic_earth

2005-05-30, 4:30 am

body {
margin: 0;
text-align: center; /* IE5 workaround */
}

#maindiv {
background-color: #eee;
width: 750px;
margin: 0 auto;
text-align: left;
}

logic_earth

2005-05-30, 7:56 am

i forgot to post a reference.

http://www.google.com/search?q=css+centering
http://www.simplebits.com/notebook/.../centering.html

Jim Moe

2005-05-30, 7:56 am

bissatch@yahoo.co.uk wrote:
>
> It is very basic that all elements will be structured using <div> tags
> and CSS styles will define the layout. What I dont know how to do is
> align the wrapper <div> (#maindiv) center. How is this done?
>

margin-left: auto;
margin-right: auto;

--
jmm dash list (at) sohnen-moe (dot) com
(Remove .AXSPAMGN for email)
Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews