Re: using css for centering

by Kid Stevens <Kidstevens(at)comcast.net>

 Date:  Mon, 03 Jun 2002 10:48:26 -0600
 To:  hwg-techniques(at)hwg.org
 References:  services
  todo: View Thread, Original
A struggle I understand all too well.  I use the latest program from
Western Civilization to help and it seems that CSS does not have any true
way to give every CSS1 compliant browser a center function.  Padding and
Margin is the only way I have found to do it.  I can use percentages and
define the right and left margins based on subtracting the width of the
widest object from an arbitrary window size.

largest element 320 px wide:
Window base size 640 px wide:
left-margin = 25%:
right-margin =25%:
leaving 25% on each side.
Now if you could tell the bounding box for your element to be 50% the page
stays centered all the time.  No matter how large the window.

CSS doesn't quite work that easy.

Western has a lite tool for both Mac and Windows. http://www.westciv.com/

At 11:26 AM -0400 6/3/02, Nate Harel wrote:
>Hi all,
>
>I am trying to be a law abiding citizen and am working as much as I can
>learning and using CSS.
>
>One of the things I am struggling with is how to center a design.
>
>I want to produce a page that is entirely centered on the page. Using
>tables, this is easy. I simply make a table with a particular width and
>center it. Then no matter the size of the screen, the contents are centered.
>
>How do I do the same with CSS?
>
>
>Nate
>
>
>
>                 ----------------------------------
>                             Nate Harel
>                         NetTech Services
>                           56 Pickering Street
>                   Needham, MA  02492-3198
>                       Tel:  1-781-559-8176
>                   Toll Free: 1-877-567-8936
>                      FAX:  1-877-567-8936
>                 Email:  nharel(at)nettech-services.net
>                      www.nettech-services.net
>                      www.nettech-backup.com
>                 ----------------------------------

-- 
Sincerely,
Kid Stevens

"I spend so much time alone that I begin to lose my humanity."
Yes I stole that from the movie "Wing Commander" and changed 3 words to suit me

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA