Next Previous Contents HTML 4.0 compliance checked by http://validator.w3.org

11.3 Complex Table Content

It's a challenge for some browsers to deal with other HTML content within a table cell. Here's a quick test of most of the HTML elements in the context of a table, of course not including head material.
Demonstration of HTML Elements Inside a Table
TagnameSectionSample Text
A (Anchor) 12.2 7.5.6 Address, to another page
Anchor (comefrom), from the last row
DIV 7.5.4 According to an example in the HTML 4.0 specification, section 7.5.4, a DIV may contain a table. The concept of hierarchical organization is not well developed in this specification, but that sort of implies that a table may not contain a DIV. Hence DIV is not tested.
SPAN 7.5.4 Demo of SPAN. This sentence, covered by a SPAN, should be red. And the cell content returns to the default color.
H1 7.5.5

Heading Type H1

H2 7.5.5

Heading Type H2

H3 7.5.5

Heading Type H3

H4 7.5.5

Heading Type H4

H5 7.5.5
Heading Type H5
H6 7.5.5
Heading Type H6
ADDRESS 7.5.6
Dave Raggett, Arnaud Le Hors, contact persons for the W3C HTML Activity
$Date: 1998-04-02 00:20:03$
EM 9.2.1 EM for emphasis.
STRONG 9.2.1 STRONG for stronger emphasis.
DFN 9.2.1 Dfn (DFN) for a word that is being defined here.
CODE 9.2.1 CODE for an inline fragment of computer code.
SAMP 9.2.1 SAMP for sample output of a program.
KBD 9.2.1 KBD for text to be entered by the user.
VAR 9.2.1 Var (VAR) for a variable name.
CITE 9.2.1 CITE for a literature citation.
ABBR 9.2.1 ABBR for an abbreviation.
ACRONYM 9.2.1 ACRONYM for an acronym.
Q (Quote) 9.2.2 Quotation: She yawns widely, showing four tiny Smilodon fangs. The browser should provide quote marks around it.
BLOCKQUOTE 9.2.2 This text precedes the blockquote, which typically has indented left and right margins and no quote marks. Here's the quote:
And I bend double, hands and feet on the ground just like Lutra lutra, the Terran river otter. With my hand I sweep two large chunks of rock over the edge and I walk out on the narrow shelf.
SUP 9.2.3 r2 (r squared)
SUB 9.2.3 gij (g subscript i and j)
P 9.3.1 Usually a table cell contains a number or a word, or at most a short phrase. However, a cell could contain several paragraphs. This paragraph begins immediately after the <TD> tag without any <P>, but here's another paragraph to follow it.

This paragraph is spaced, aligned and justified in the default style for the browser. It's padded out with enough words to ensure that it wraps into multiple lines.

align=left 9.3.1

This paragraph is aligned left using the ALIGN=LEFT attribute. It's padded out with enough words to ensure that it wraps into multiple lines.

align=right 9.3.1

This paragraph is aligned right using the ALIGN=RIGHT attribute. It's padded out with enough words to ensure that it wraps into multiple lines.

align=center 9.3.1

This paragraph is centered using the ALIGN=CENTER attribute. It's padded out with enough words to ensure that it wraps into multiple lines.

align=justify 9.3.1

This paragraph is justified (if the browser can do that) using the ALIGN=JUSTIFY attribute. It's padded out with enough words to ensure that it wraps into multiple lines.

BR 9.3.2 Line breaks can be*
inserted at arbitrary places in the text using the BR tag (there's one at the asterisk).
DEL 9.4

This paragraph is marked with DEL.

So is this one.

INS 9.4

This paragraph is marked with INS.

So is this one.

UL, LI 10.2
  • Unordered list, item one
  • Item two
OL, LI 10.2
  1. Ordered list (Roman), item one
  2. Item two
DL, DT, DD 10.3
Term 1
Definition 1 of definition list
Term 2
Definition 2 of definition list
TABLE 11.1
Table Within a Table
Row/ColColumn 1Column 2
Row ACell A1Cell A2
Row BCell B1Cell B2
IMAGE 13.2 HTML 4.0 compliance checked by http://validator.w3.org
OBJECT (image) 13.3 Alternative text for flying message, which should not be shown.
APPLET 13.4 (Not tested)
MAP, AREA 13.6 (Not tested)
CENTER 15.1.2
Should center this text.
Colors 6.5
Color Demonstration (2 Columns)
In Monochrome In Color
Maroon Maroon
Red Red
Purple Purple
Fuchsia Fuchsia
Green Green
Lime Lime
Olive Olive
Yellow Yellow
Navy Navy
Blue Blue
Teal Teal
Aqua Aqua
TT 15.2.1 TT for monospace (typewriter) font.
I (italic) 15.2.1 <I> for italic font.
B (bold) 15.2.1 B for bold font.
BIG 15.2.1 BIG for a bigger font than the default.
SMALL 15.2.1 SMALL for a smaller font than the default.
STRIKE, S 15.2.1 STRIKE or S for strikeout font (deprecated).
U (underline) 15.2.1 U for underlined text (deprecated).
These four items are done with style effects and include a patch of italic text in the middle.
Upper Case 15.2.1 This Sentence Has A Style Effect Making It All Upper Case.
Lower Case 15.2.1 This Sentence Has A Style Effect Making It All Lower Case.
Capitalize 15.2.1 this sentence has a style effect capitalizing each word, where the original had no capitals.
Small Caps 15.2.1 This Sentence Has A Style Effect Setting It In A Small Capital Font.
FONT 15.2.2 Cursive: The quick brown fox jumped over the lazy dog's back. 0123456789.
HR 15.2.3 The rule below should span just this cell. There's another demo with the paragraph-related tags.
FRAME 16.2.2 (Not tested)
IFRAME 16.5 The iframe has a width of 150px, height 130px, and an external margin of 20px all around.
FORM 17.3

Buttons and Text Fields

MasterSplurge
Vices
American Excess

A (Anchor) 12.2 Go to the first row

The following HTML elements may be too wide for the prespecified column widths in the table, presenting the browser with a dilemma: to obey the column width and wrap the content contrary to its nature, or to obey the content and expand the column beyond the user-specified value.
Demonstration of Wide HTML Elements in a Table
TagnameSectionSample Text
PRE 9.3.4 Here's the poem from the HTML 4.0 standard:
 
         Higher still and higher
           From the earth thou springest
         Like a cloud of fire;
           The blue deep thou wingest,
  And singing still dost soar, and soaring ever singest.

Shelly, To a Skylark.
The related deprecated LISTING and XMP tags are not tested.
;&nbsp; 9.3.2 The nonbreak space has an entity code of &nbsp;. The browser should either wrap in the middle of a word or should make the sentences hang off the right edge of the window, possibly with scrollbars (how's that for about 180 bytes of run-on sentence, eh?)
;&shy; 9.3.2 Soft hyphens introduce line break opportunities within words. Ses­qui­pedal­ian 4H-1,3-dioxo­lo[4,5-d]imid­azole anti­dis­establish­ment­arian­ism 7H-pir­azino[2,3-c]carb­azole sil­ico­vol­cano­pneu­mo­coni­osis 7H-indo­lo[3,2-f]quin­oxa­line.


Next Previous Contents