[thelist] centering a flexible-width div

Ben Glassman bglassman at gmail.com
Mon Mar 19 14:03:06 CDT 2007


You could set the margins to equal percentages and make sure that they add
up to 100% when added to the width of the div (width: 80%; padding-left:
10%; padding-right: 10%). You could also set the width of the div to 100%
and then set left and right padding on its parent element (for example body
{ padding: 0 15%; }

Hope that helps,

Ben

On 3/19/07, Joel D Canfield <joel at streamliine.com> wrote:
>
> > "margin-left: auto; margin-right: auto;" does not work since
> > the width is not defined ...
>
> I'm curious why this
>
>     margin:0 auto;
>
> would require the width to be explicitly defined, assuming that's what you
> mean? (of course, the zero could be whatever top/bottom margin you like)
>
> joel
>
> --
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.5.446 / Virus Database: 268.18.13/726 - Release Date: 3/18/2007
> 3:34 PM
>
> --
>
> * * Please support the community that supports you.  * *
> http://evolt.org/help_support_evolt/
>
> For unsubscribe and other options, including the Tip Harvester
> and archives of thelist go to: http://lists.evolt.org
> Workers of the Web, evolt !
>



More information about the thelist mailing list