What can be inside a div?

F

Falc2199

Is there any limitations as to what can be inside <div id = "" >
</div> ? Can you place TDs and TRs for table inside it?

Thanks,
Jehan
 
D

Dag Sunde

Falc2199 said:
Is there any limitations as to what can be inside <div id = "" >
</div> ? Can you place TDs and TRs for table inside it?

Why not try it?
The answer is only 1 minute in a text-editor away...

You can put any ordinary html-tag inside a <div> section.
 
M

Martin Sammtleben

Is there any limitations as to what can be inside <div id = "" >
</div> ? Can you place TDs and TRs for table inside it?

A <div> is nothing but a generic container that defaults to
display:block, forcing a line break before and after, as opposed to
<span> which defaults to display:inline.

You can however set a <div> to float or inline using css.

To answer your question, you can put just about any element inside a
<div>.
 
I

Ivo

Why not try it?
The answer is only 1 minute in a text-editor away...

You can put any ordinary html-tag inside a <div> section.

Exactly. A good text-editor allows you to type
<div><html></html></div>
but there certain limitations as to what is valid in a properly marked up
document. TDs and TRs for example can only used inside a TABLE. The use of
DIV elements as explained at
<URL: http://www.w3.org/TR/REC-html40/struct/global.html#h-7.5.4 >
features an example of a table inside a div.
As far as javascript is concerned (this newsgroup's topic), strange markup
may cause strange behaviour.
Ivo
 
J

jackie

even google can't pass it 100%

Andrew Thompson said:
Is there any limitations as to what can be inside <div id = "" >
</div> ? Can you place TDs and TRs for table inside it?

<http://validator.w3.org/>

If more web-desingers, Javascript and
Java programmers used it, the web would
be a better place for it.

[ ..and yes, the information given to you over
on c.i.w.a.s seems correct. ]

--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
 
T

Tim Slattery

Is there any limitations as to what can be inside <div id = "" >
</div> ? Can you place TDs and TRs for table inside it?

You can put an entire table inside of a DIV, but you can't put only
part of a table into a DIV. Unfortunate, if you could do that you
could make a table where the headers are always visible but the
content scrolls under them. (I know, you can simulate that with two
tables.)
 
R

Richard Cornford

Tim Slattery wrote:
<snip
You can put an entire table inside of a DIV, but you
can't put only part of a table into a DIV. Unfortunate,
if you could do that you could make a table where the
headers are always visible but the content scrolls under
them. (I know, you can simulate that with two tables.)

As the contents of tables are already partitioned into THEAD, TFOOT
(both optional) and one or more TBODY (by implication if not explicitly
provided in the HTML) there would be no need to place a DIV into a table
to separately group its contents. To scroll a table body while the
headers stay still should only require that the TBODY have a scrolling
overflow CSS property while the THEAD did not. Reality doesn't deliver
on that either but there is still no advantage for DIVs to be allowed in
that context.

Richard.
 
T

Thomas 'PointedEars' Lahn

Richard said:
As the contents of tables are already partitioned into THEAD, TFOOT
(both optional) and one or more TBODY (by implication if not explicitly
provided in the HTML) there would be no need to place a DIV into a table
to separately group its contents. To scroll a table body while the
headers stay still should only require that the TBODY have a scrolling
overflow CSS property while the THEAD did not. Reality doesn't deliver
on that either [...]

It does in Gecko-based browsers, however cross-browser support is
limited and maybe the feature implementation in Gecko is buggy.
Maybe <http://www.stud.tu-ilmenau.de/~thla-in/ufpdb/transprt/> is
a bad example (only a quickhack, seems the body is too wide), but
it is still an example that it can be done.


PointedEars
 
R

Richard Cornford

Thomas said:
Richard Cornford wrote:
... . To scroll a table body while the headers stay still
should only require that the TBODY have a scrolling overflow
CSS property while the THEAD did not. Reality doesn't deliver
on that either [...]

It does in Gecko-based browsers, however cross-browser support is
limited and maybe the feature implementation in Gecko is buggy.
Maybe <http://www.stud.tu-ilmenau.de/~thla-in/ufpdb/transprt/> is
a bad example (only a quickhack, seems the body is too wide), but
it is still an example that it can be done.

Yes it can be done, and I am optimistic that in future it will be widely
supported and commonly done, as there certainly seems to be demand for
the facility. But in our current climate if it cannot be done in IE you
won't be able to sell the idea in any commercial context.

On the other hand, maybe a comparison of clientHeight and scrollHeigth
(or similar dimensions) could tell you when TBODY was not honouring
scrolling overflow and allow a bit of DOM manipulation to have the TBODY
pulled from the original table and inserted into a second within a
specially created scrolling DIV, as a fallback for IE. Unfortunately
that would be javascript dependent while the CSS approach is not.

Richard.
 
T

Tim Slattery

Looks to me like that page is implemented by putting the table header
and body in different frames. Not really an example of what we're
talking about.
 
T

Thomas 'PointedEars' Lahn

Tim said:
Looks to me like that page is implemented by putting the table header
and body in different frames.

Look into it again with a *Gecko-based* browser. Only the index
buttons are in another frame, not the table headers. Here is the
URL of the content frame (containing the entire table):


Not really a valid signature delimiter. Should be dashDashSpace.


F'up2 poster

PointedEars
 
T

Thomas 'PointedEars' Lahn

Richard said:
Thomas said:
Richard Cornford wrote:
... . To scroll a table body while the headers stay still should only
require that the TBODY have a scrolling overflow CSS property while
the THEAD did not. Reality doesn't deliver on that either [...]

It does in Gecko-based browsers, however cross-browser support is
limited and maybe the feature implementation in Gecko is buggy. Maybe
<http://www.stud.tu-ilmenau.de/~thla-in/ufpdb/transprt/> is a bad
example (only a quickhack, seems the body is too wide), but it is still
an example that it can be done.

Yes it can be done, and I am optimistic that in future it will be widely
supported and commonly done, as there certainly seems to be demand for
the facility.

If nobody (or not enough people) push(es) the issue by using the feature,
it will never be widely implemented with the lame excuse that there is
no(t enough) demand for it.
But in our current climate if it cannot be done in IE you
won't be able to sell the idea in any commercial context.

1. Why would I want to sell it? I assume people are smart anough to see
where are the advantages and disadvantages for themselves. Don't you
think that if one visits the site with different browsers and see that
Gecko-based ones (or basically all that implement the discussed feature)
have an advantage here will recognize it?

2. Disagreed. Taking the other, much more serious bugs and security flaws
of IE into account, I am confident that one can be convinced to support
more standards-compliant and secure browsers and provide for graceful
degradation for the rest, which IMHO a table where the headers also
scroll certainly is.


PointedEars
 
R

Richard Cornford

If nobody (or not enough people) push(es) the issue by using the
feature, it will never be widely implemented with the lame excuse
that there is no(t enough) demand for it.

I am not sure this one needs promoting, just implementing. It is
actually mentioned as a possibility in the HTML specs (in the section on
THEAD, TBODY, TFOOT) and implied (at least not excluded) by the CSS
specs.
1. Why would I want to sell it? I assume people are smart anough to
see where are the advantages and disadvantages for themselves.
Don't you think that if one visits the site with different
browsers and see that Gecko-based ones (or basically all that
implement the discussed feature) have an advantage here will
recognize it?

I don't mean sell it in the sense of promote it. I mean, given a client
who wants a table body to scroll and the headers to (at least
apparently) stay still, presenting them with code that works fine in
Gecko browsers (and any number of others) but not IE is not going to
work. If they don't see it working in IE then as far as they are
concerned you haven't delivered.

Whatever you or I may think of that, it is a hard commercial reality.
2. Disagreed. Taking the other, much more serious bugs and security
flaws of IE into account, I am confident that one can be convinced
to support more standards-compliant and secure browsers and
provide for graceful degradation for the rest, which IMHO a table
where the headers also scroll certainly is.

The marketing managers who think flashy presentation sells things, but
know nothing about the technicalities (why should they?), look at the
browser statistics (which they also don't understand) and decide that
the apparently most popular browsers are an environment in which it is
vital to be able to make that flashy presentation. You can explain that
the statistics are horribly inaccurate and biased and that using
standard promotes interoperability etc, but if you don't give them what
they want in javascript enabled IE 6 then you haven't delivered.

For that to change it is the users that need to be convinced to be using
other browsers. Security flaws in IE, Microsoft's reluctance to update
it and ever better alternative browsers seem to be producing some change
in that direction, but not yet enough to stop (active) IE 6 support from
being the absolute minimum requirement for any commercial project.

Richard.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top