Click here to get back home

DIVs inside table cells?

 HomeNewsGroups | Search | About
 comp.infosystems.www.authoring.html    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
DIVs inside table cells? Test 04-13-2008
Posted by Test on April 13, 2008, 9:46 am
Please log in for more thread options
Is it possibel to have DIV's inside a table cell so that their position can be
given relative to top left corner of the cell. Now the DIVs seem to position
themselves relative to previous object.

Posted by Harlan Messinger on April 13, 2008, 10:50 am
Please log in for more thread options
Test wrote:
> Is it possibel to have DIV's inside a table cell so that their position can be
> given relative to top left corner of the cell.

Yes.

> Now the DIVs seem to position
> themselves relative to previous object.

Without seeing your page it isn't possible for anyone to know what you
should expect to see or what you need to do to change it.

If the position of the cell is specified "relative" then a DIV inside it
with position: absolute should be positioned relative to the cell's
origin, and IE 7 does this, but on the other hand if the cell is styled
with a border, the border disappears. Firefox, in contrast, positions
the DIV relative to the viewport origin (assuming there are no
containing blocks between the viewport and the cell; I didn't test any
other case).

If you nest the DIV inside another, relative positioned DIV, inside the
cell, which now doesn't have to be relative positioned, then the
positioning works in Firefox.

So I think Firefox has a bug in this respect.

Posted by rf on April 13, 2008, 7:27 pm
Please log in for more thread options

> Test wrote:
>> Is it possibel to have DIV's inside a table cell so that their
>> position can be given relative to top left corner of the cell.
>
> Yes.
>
>> Now the DIVs seem to position
>> themselves relative to previous object.
>
> Without seeing your page it isn't possible for anyone to know what you
> should expect to see or what you need to do to change it.
>
> If the position of the cell is specified "relative" then a DIV inside
> it with position: absolute should be positioned relative to the cell's
> origin, and IE 7 does this, but on the other hand if the cell is
> styled with a border, the border disappears. Firefox, in contrast,
> positions the DIV relative to the viewport origin (assuming there are
> no containing blocks between the viewport and the cell; I didn't test
> any other case).
>
> If you nest the DIV inside another, relative positioned DIV, inside
> the cell, which now doesn't have to be relative positioned, then the
> positioning works in Firefox.
>
> So I think Firefox has a bug in this respect.

http://www.w3.org/TR/CSS21/visuren.html#propdef-position

"The effect of 'position: relative on ... table-cell ... is undefined."
All browsers are behaving correctly. If the effect is undefined they are
free to do whatever they want.


--
Richard
Killing all threads involving google groups
The Usenet Improvement Project: http://improve-usenet.org

Posted by Harlan Messinger on April 13, 2008, 9:08 pm
Please log in for more thread options
rf wrote:
>
>> Test wrote:
>>> Is it possibel to have DIV's inside a table cell so that their
>>> position can be given relative to top left corner of the cell.
>> Yes.
>>
>>> Now the DIVs seem to position
>>> themselves relative to previous object.
>> Without seeing your page it isn't possible for anyone to know what you
>> should expect to see or what you need to do to change it.
>>
>> If the position of the cell is specified "relative" then a DIV inside
>> it with position: absolute should be positioned relative to the cell's
>> origin, and IE 7 does this, but on the other hand if the cell is
>> styled with a border, the border disappears. Firefox, in contrast,
>> positions the DIV relative to the viewport origin (assuming there are
>> no containing blocks between the viewport and the cell; I didn't test
>> any other case).
>>
>> If you nest the DIV inside another, relative positioned DIV, inside
>> the cell, which now doesn't have to be relative positioned, then the
>> positioning works in Firefox.
>>
>> So I think Firefox has a bug in this respect.
>
> http://www.w3.org/TR/CSS21/visuren.html#propdef-position
>
> "The effect of 'position: relative on ... table-cell ... is undefined."
> All browsers are behaving correctly. If the effect is undefined they are
> free to do whatever they want.

Ah, OK, thanks. I was concentrating on the section on absolute
positioning and didn't bother to read the section on relative positioning.

Posted by Ben C on April 14, 2008, 3:19 am
Please log in for more thread options
> rf wrote:
>>
>>> Test wrote:
>>>> Is it possibel to have DIV's inside a table cell so that their
>>>> position can be given relative to top left corner of the cell.
>>> Yes.
>>>
>>>> Now the DIVs seem to position
>>>> themselves relative to previous object.
>>> Without seeing your page it isn't possible for anyone to know what you
>>> should expect to see or what you need to do to change it.
>>>
>>> If the position of the cell is specified "relative" then a DIV inside
>>> it with position: absolute should be positioned relative to the cell's
>>> origin, and IE 7 does this, but on the other hand if the cell is
>>> styled with a border, the border disappears. Firefox, in contrast,
>>> positions the DIV relative to the viewport origin (assuming there are
>>> no containing blocks between the viewport and the cell; I didn't test
>>> any other case).
>>>
>>> If you nest the DIV inside another, relative positioned DIV, inside
>>> the cell, which now doesn't have to be relative positioned, then the
>>> positioning works in Firefox.
>>>
>>> So I think Firefox has a bug in this respect.
>>
>> http://www.w3.org/TR/CSS21/visuren.html#propdef-position
>>
>> "The effect of 'position: relative on ... table-cell ... is undefined."
>> All browsers are behaving correctly. If the effect is undefined they are
>> free to do whatever they want.
>
> Ah, OK, thanks. I was concentrating on the section on absolute
> positioning and didn't bother to read the section on relative positioning.

rf is right and I almost mentioned that, but I really do think this is a
bit of a loophole. If it was intentional they would have said something
about it in the section on containing block.

All they mean IMO is that it's undefined when you start setting top,
left etc. on relatively positioned table cells.

After all everything else can be a containing block for positioned
descendents, even inline boxes (and that's much madder than
table-cells).

Similar ThreadsPosted
img table cells next to each other without a gap possible? May 26, 2006, 10:27 pm
fixed table cells January 23, 2007, 11:40 pm
Table cells change size March 1, 2005, 9:02 pm
Table with 100% width but relative cells? June 1, 2005, 11:08 am
Freezing the width of TABLE cells June 20, 2008, 1:12 pm
Newbie: Problems with table cells & colspan August 9, 2004, 7:11 pm
There is no gap between cells in html table with CELLSPACING greater than zero August 25, 2004, 11:38 am
Optimized table with fixed size cells? February 4, 2007, 5:17 pm
how to properly hide/show table cells? January 31, 2008, 5:38 pm
HT make table data cells equal in width? May 9, 2007, 9:00 pm

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap