[thelist] embedded layers into a 1 cell table ?

Douglas Evolt at neuance.net
Thu May 20 06:04:34 CDT 2004


> I'l heartly thank if anybody could show some light over my problem:
>
> 1) Initially I created a web designed for 800x600px screen with the  
> following structure:

> 2) I've sttled a ONE CELL CENTERD TABLE, but whem trying to embed the 5  
> inner layers into the cell i didn't work.

In your sample, the divs are not inside your centered table, but even if  
they were you would still have difficulties.

You don't need any tables on this page. none.

Right after your body yag, put this in:

<div style="position: relative; width: 750px; margin: auto; text-align:  
left;">

And then right before you're </body> tag, put this in:

</div>

Lastyl, in your body tag itself, make it look something like this:

<body style="text-align: center;" onLoad="M..... etc etc">

So, what is going on here?

In the div I've added, there is a position: relative. This means that all  
the position: absolute divs inside it will align relative to this one.  
(This happens when you set a div to anything apart from the default,  
position: static.)

Next, we set a width on this div. That width should be the width of your  
content. You can fine tune that value.

The centering comes from the "margin: auto" part. This makes the left and  
right margins take up an equal amount of space, basically centering the  
div. This doesn't work in IE5, so we also add "text-align: center" in the  
body tag to get it to work in IE5, and then a corresponding text-align:  
left in the div to make sue that your textitself isn't centred.

hth,
Douglas


More information about the thelist mailing list