![]() |
|
|
|||||||
![]() |
HTML - Whats wrong with DIV in Table? |
|
|
Thread Tools | Search this Thread |
|
|
#1 |
|
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 |
|
|
|
|
#2 |
|
Posts: n/a
|
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 |
|
|
|
#3 |
|
Posts: n/a
|
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 # |
|
|
|
#4 |
|
Posts: n/a
|
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 |
|
|
|
#5 |
|
Posts: n/a
|
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> |
|
|
|
#6 |
|
Posts: n/a
|
"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> : ) |
|
|
|
#7 |
|
Posts: n/a
|
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 |
|
|
|
#8 |
|
Posts: n/a
|
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. |
|
|
|
#9 |
|
Posts: n/a
|
"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 |
|