473,386 Members | 1,758 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Div alignment

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
1 4855
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 vão. O resto é imperfeito.
- Renato Russo -

Jul 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Shashi | last post by:
Can somebody explain how the byte alignment for structures work, taking the following example and considering: byte of 1 Byte word of 2 Bytes dword of 4 Bytes typedef struct { byte a; word...
10
by: j0mbolar | last post by:
for any pointer to T, does a pointer to T have different or can have different alignment requirement than a pointer to pointer to T? if so, where is the exact wording in the standard that would...
67
by: S.Tobias | last post by:
I would like to check if I understand the following excerpt correctly: 6.2.5#26 (Types): All pointers to structure types shall have the same representation and alignment requirements as each...
7
by: Earl | last post by:
Any known fixes for the wacky right-alignment bug in the WinForms datagrid (VS2003)? I've tried Ken's workaround...
13
by: aegis | last post by:
The following was mentioned by Eric Sosman from http://groups.google.com/group/comp.lang.c/msg/b696b28f59b9dac4?dmode=source "The alignment requirement for any type T must be a divisor of...
12
by: Yevgen Muntyan | last post by:
Hey, Consider the following code: #include <stdlib.h> #define MAGIC_NUMBER 64 void *my_malloc (size_t n) { char *result = malloc (n + MAGIC_NUMBER);
10
by: haomiao | last post by:
I want to implement a common list that can cantain any type of data, so I declare the list as (briefly) --------------------------------------- struct list { int data_size; int node_num;...
55
by: fishpond | last post by:
How to declare a variable guaranteed to have the strictest possible alignment? -- The defense attorney was hammering away at the plaintiff: "You claim," he jeered, "that my client came at you...
2
by: somenath | last post by:
Hi All, I have one question regarding the alignment of pointer returned by malloc. In K&R2 page number 186 one union is used to enforce the alignment as mentioned bellow. typedef long...
2
by: uamusa | last post by:
I am Dynamically generating a proposal(report) in MS Word. By default the Paragraph Alignment is "Left". For the First 6 Paragraphs I set the Alignment to "Center", and then when attempting to...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.