Re: using css for centering
by "Darrell King" <darrell(at)webctr.com>
|
Date: |
Mon, 3 Jun 2002 18:18:17 -0400 |
To: |
<hwg-techniques(at)hwg.org> |
References: |
services |
|
todo: View
Thread,
Original
|
|
Actually, you center a block-level element in compliant browsers with
margin: auto. This does not work in IE5.5, but that is a browser bug and
doesn't change the validity of the technique.
As a workaround in IE5.5, you can place the block-level element to be
centered inside a div that has text-align: center assigned to it. Then, to
endure that compliant browsers also center the target element, assign
margin: auto to that element as well.
D
----- Original Message -----
From: "Kid Stevens" <
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
>
HWG hwg-techniques mailing list archives,
maintained by Webmasters @ IWA