469,352 Members | 1,782 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,352 developers. It's quick & easy.

Items aligning left instead of centering

Hello monsters of CSS. I was wondering if you could help me with a
layout problem.

Here's a test page that demonstrates the problem:

http://64.142.13.246/ls/test.htm

(I've given the DIVs height and color to make it obvious what contains
what. In the evenual working application they would be invisible.)

In IE, the div with id "centerContainer" (dark grey) is properly
centered in the document window. In Mozilla, that div is aligned left,
bringing everything it contains over to the left.

The CSS styles are embedded in the document for convenience here, but
normally I'd import them.

Any help with this would be greatly appreciated!

Thanks,

Phester

Jul 20 '05 #1
2 2017
On Sun, 26 Oct 2003 00:53:33 GMT, Phester
<ph*****@nonexistenthost.com> wrote:
Hello monsters of CSS. I was wondering if you could help me with a
layout problem.

Here's a test page that demonstrates the problem:

http://64.142.13.246/ls/test.htm

(I've given the DIVs height and color to make it obvious what contains
what. In the evenual working application they would be invisible.)

In IE, the div with id "centerContainer" (dark grey) is properly
centered in the document window.

[...]

Actually, IE is in error. It appears that you have given the
surrounding container (<div id="pageWide">) the declaration of
"text-align: center" to try to center the <div id="centeredContainer">
within it. Actually, that is not supposed to center a block, but
rather, it should center inline content such as text. What you should
do is set the left and right margins of the #centeredContainer to
"auto" which will center a block in conforming browsers such as
Mozilla.

For more details, see:

<http://theodorakis.net/blockcenter.html>

Nick

--
Nick Theodorakis
ni**************@hotmail.com
nicholas_theodorakis [at] urmc [dot] rochester [dot] edu
Jul 20 '05 #2
Nick Theodorakis wrote:
On Sun, 26 Oct 2003 00:53:33 GMT, Phester
<ph*****@nonexistenthost.com> wrote:

Hello monsters of CSS. I was wondering if you could help me with a
layout problem.

Here's a test page that demonstrates the problem:

http://64.142.13.246/ls/test.htm

(I've given the DIVs height and color to make it obvious what contains
what. In the evenual working application they would be invisible.)

In IE, the div with id "centerContainer" (dark grey) is properly
centered in the document window.


[...]

Actually, IE is in error. It appears that you have given the
surrounding container (<div id="pageWide">) the declaration of
"text-align: center" to try to center the <div id="centeredContainer">
within it. Actually, that is not supposed to center a block, but
rather, it should center inline content such as text. What you should
do is set the left and right margins of the #centeredContainer to
"auto" which will center a block in conforming browsers such as
Mozilla.

For more details, see:

<http://theodorakis.net/blockcenter.html>

Nick


Thanks a lot. That's a huge help. I haven't had time to try it out yet,
but I will and I'll check out your article.

Phester

Jul 20 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Phester | last post: by
18 posts views Thread by Chris | last post: by
7 posts views Thread by Scott Teglasi | last post: by
2 posts views Thread by Dave | last post: by
4 posts views Thread by Greg Scharlemann | last post: by
14 posts views Thread by gaijinco | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.