By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,765 Members | 1,290 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,765 IT Pros & Developers. It's quick & easy.

Div alignment

P: n/a
CCC
Hello,

I am attempting to center a div on a page. I have a dumbed down
version of my page here:

<body>
<div id="outercontainer" align="center" style="position:relative;
background-color: #ff0000;">
<div id="innercontainer" style="position:relative;
text-align:left; width:600px; background-color: #fff000;">
This is a test of the two container to see if they stop at the
left
</div>
</div>
</body>

The page centers correctly in Mozilla1.6 and IE6, but when you resize
the browser IE keeps it in the middle until the browser becomes
smaller than the div. Once it becomes smaller than the div, the div
stops moving at the left margin. With Mozilla the div keeps centering
so the div sort of disappears into the left margin. Now the Mozilla
action makes more sense as to why it is doing that, but unfortunately
I would prefer it to do what IE does which is to center the div until
the browser gets resized smaller and then just keep it justified to
the left margin.

Can this be achieved?

Thanks,
Chris
Jul 20 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Els
CCC wrote:
Hello,

I am attempting to center a div on a page. I have a dumbed down
version of my page here:

<body>
<div id="outercontainer" align="center" style="position:relative;
background-color: #ff0000;">
<div id="innercontainer" style="position:relative;
text-align:left; width:600px; background-color: #fff000;">
This is a test of the two container to see if they stop at the
left
</div>
</div>
</body>

The page centers correctly in Mozilla1.6 and IE6, but when you resize
the browser IE keeps it in the middle until the browser becomes
smaller than the div. Once it becomes smaller than the div, the div
stops moving at the left margin. With Mozilla the div keeps centering
so the div sort of disappears into the left margin. Now the Mozilla
action makes more sense as to why it is doing that, but unfortunately
I would prefer it to do what IE does which is to center the div until
the browser gets resized smaller and then just keep it justified to
the left margin.

Can this be achieved?


Just add a border to the outercontainer :-)
Have it the same colour as the background, and you won't
even have to see it.

--
Els
http://locusmeus.com/
Sonhos vem. Sonhos vo. O resto imperfeito.
- Renato Russo -

Jul 20 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.