473,471 Members | 1,722 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 4860
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: 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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.