Go Back   Velocity Reviews > Newsgroups > HTML
User Name
Password
Register FAQ Members List Calendar Search Today's Posts Mark Forums Read

Reply

HTML - Whats wrong with DIV in Table?

 
Thread Tools Search this Thread
Old 01-17-2005, 01:58 PM   #1
Default Whats wrong with DIV in Table?


Hello! I have the html-code attached. It is shown well in Firefox for
example, but in Internet-Explorer 6.0 "div3" with "My Div Text" is not
shown at all. When removing all the TABLE-Tags, it works in IE as well,
but I need the table. Any ideas why div3 is not shown? Can somebody
confirm the error or am I doing something wrong?

Martin


<HTML>
<BODY>

<div id="div1"
style="position:absolute;top:0px;left:0px;height:8 00px;visibility:visible;overflow:hidden;border:1px
solid black">
<div id="div2"
style="position:relative;left:0px;top:0px;border:0 px;overflow-y:hidden;overflow-x:hidden;border:1px
solid black">
<TABLE ALIGN=LEFT BORDER="1" CELLPADDING="0" CELLSPACING="0">
<TR><TD ALIGN="LEFT" VALIGN="TOP">
<div id="div3"
style="position:relative;left:0px;top:0px;width:20 0px;height:100px;background:#FF0000;visibility:vis ible">
My Div Text
</div>
</TD></TR></TABLE>
</div></div>

</BODY>
</HTML>



Martin Schneider
  Reply With Quote
Old 01-17-2005, 02:47 PM   #2
Roy Schestowitz
 
Posts: n/a
Default Re: Whats wrong with DIV in Table?

Martin Schneider wrote:

> Hello! I have the html-code attached. It is shown well in Firefox for
> example, but in Internet-Explorer 6.0 "div3" with "My Div Text" is not
> shown at all. When removing all the TABLE-Tags, it works in IE as well,
> but I need the table. Any ideas why div3 is not shown? Can somebody
> confirm the error or am I doing something wrong?
>
> Martin
>
>
> <HTML>
> <BODY>
>
> <div id="div1"
>

style="position:absolute;top:0px;left:0px;height:8 00px;visibility:visible;overflow:hidden;border:1px
> solid black">
> <div id="div2"
>

style="position:relative;left:0px;top:0px;border:0 px;overflow-y:hidden;overflow-x:hidden;border:1px
> solid black">
> <TABLE ALIGN=LEFT BORDER="1" CELLPADDING="0" CELLSPACING="0">
> <TR><TD ALIGN="LEFT" VALIGN="TOP">
> <div id="div3"
>

style="position:relative;left:0px;top:0px;width:20 0px;height:100px;background:#FF0000;visibility:vis ible">
> My Div Text
> </div>
> </TD></TR></TABLE>
> </div></div>
>
> </BODY>
> </HTML>


Div inside a table? Isn't that a violation of HTML validity? Div can at
fixed positions as well so I wonder how this fits within a table. Someone
more knowledgeable will give a definite answer, I'm sure, but these are
just my 2 cents.

--
Roy Schestowitz
http://schestowitz.com
  Reply With Quote
Old 01-17-2005, 03:40 PM   #3
SpaceGirl
 
Posts: n/a
Default Re: Whats wrong with DIV in Table?

Roy Schestowitz wrote:
> Martin Schneider wrote:
>
>
>>Hello! I have the html-code attached. It is shown well in Firefox for
>>example, but in Internet-Explorer 6.0 "div3" with "My Div Text" is not
>>shown at all. When removing all the TABLE-Tags, it works in IE as well,
>>but I need the table. Any ideas why div3 is not shown? Can somebody
>>confirm the error or am I doing something wrong?
>>
>>Martin
>>
>>
>><HTML>
>><BODY>
>>
>><div id="div1"
>>

>
> style="position:absolute;top:0px;left:0px;height:8 00px;visibility:visible;overflow:hidden;border:1px
>
>>solid black">
>><div id="div2"
>>

>
> style="position:relative;left:0px;top:0px;border:0 px;overflow-y:hidden;overflow-x:hidden;border:1px
>
>>solid black">
>><TABLE ALIGN=LEFT BORDER="1" CELLPADDING="0" CELLSPACING="0">
>><TR><TD ALIGN="LEFT" VALIGN="TOP">
>><div id="div3"
>>

>
> style="position:relative;left:0px;top:0px;width:20 0px;height:100px;background:#FF0000;visibility:vis ible">
>
>>My Div Text
>></div>
>></TD></TR></TABLE>
>></div></div>
>>
>></BODY>
>></HTML>

>
>
> Div inside a table? Isn't that a violation of HTML validity? Div can at
> fixed positions as well so I wonder how this fits within a table. Someone
> more knowledgeable will give a definite answer, I'm sure, but these are
> just my 2 cents.
>


No... a div can be anywhere text can be...

<table><tr><td><div>my text</div></td></tr></table>

....is perfectly valid. If the OP removes pos:rel, it might work.

--


x theSpaceGirl (miranda)

# lead designer @ http://www.dhnewmedia.com #
# remove NO SPAM to email, or use form on website #
  Reply With Quote
Old 01-17-2005, 03:52 PM   #4
Martin Schneider
 
Posts: n/a
Default Re: Whats wrong with DIV in Table?

Thanks for all the answers.

> No... a div can be anywhere text can be...
>
> <table><tr><td><div>my text</div></td></tr></table>
>
> ...is perfectly valid. If the OP removes pos:rel, it might work.

Well, then it really DOES work, but I need to change the position to
pos:rel is exactly what it should be.

Martin


  Reply With Quote
Old 01-17-2005, 05:18 PM   #5
Leif K-Brooks
 
Posts: n/a
Default Re: Whats wrong with DIV in Table?

SpaceGirl wrote:
> No... a div can be anywhere text can be...


No, a DIV element can be anywhere that block-level content can go. This
is not valid:

<span><div>foo</div></span>
  Reply With Quote
Old 01-17-2005, 05:41 PM   #6
Noozer
 
Posts: n/a
Default Re: Whats wrong with DIV in Table?


"Leif K-Brooks" <> wrote in message
news:...
> SpaceGirl wrote:
> > No... a div can be anywhere text can be...

>
> No, a DIV element can be anywhere that block-level content can go. This
> is not valid:
>
> <span><div>foo</div></span>


....so this is better?

<span><span style="display: block;">foo</span></span>

: )


  Reply With Quote
Old 01-17-2005, 07:17 PM   #7
Toby Inkster
 
Posts: n/a
Default Re: Whats wrong with DIV in Table?

Noozer wrote:
> Leif K-Brooks wrote:
>
>> No, a DIV element can be anywhere that block-level content can go. This
>> is not valid:
>> <span><div>foo</div></span>

>
> ...so this is better?
> <span><span style="display: block;">foo</span></span>


Yes. But this is the best:
<span><object><div>foo</div></object></span>

--
Toby A Inkster BSc (Hons) ARCS
Contact Me ~ http://tobyinkster.co.uk/contact

  Reply With Quote
Old 01-17-2005, 07:19 PM   #8
Richard
 
Posts: n/a
Default Re: Whats wrong with DIV in Table?

On Mon, 17 Jan 2005 14:58:49 +0100 Martin Schneider wrote:

> Hello! I have the html-code attached. It is shown well in Firefox for
> example, but in Internet-Explorer 6.0 "div3" with "My Div Text" is not
> shown at all. When removing all the TABLE-Tags, it works in IE as well,
> but I need the table. Any ideas why div3 is not shown? Can somebody
> confirm the error or am I doing something wrong?


> Martin


Remove the "position" stuff. Not needed.
enter text into div 1 and 2 and you'll see what you've told IE to do.
without something definitive in the divisions, they do not appear.
That's kind of a quirk of IE.

Use position only to point an object in a specified location, such as your
table.
Absolute defines position from the top left corner of the browser window.
Relative defines position from the top lef corner of the container, a
division.


  Reply With Quote
Old 01-17-2005, 07:56 PM   #9
Steve Pugh
 
Posts: n/a
Default Re: Whats wrong with DIV in Table?

"Richard" <Anonymous@127.001> wrote:

>Absolute defines position from the top left corner of the browser window.


No it doesn't. It defines position relative to the containing block.
The CB is the closest ancestor element with position set to anything
other than static; if no ancestor element qualifies then the Initial
Containing Block is used. The ICB is usually the same as the browser
window.

>Relative defines position from the top lef corner of the container, a
>division.


No it doesn't. It defines position relative to the static position of
the element.

Steve

  Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump