Movatterモバイル変換


[0]ホーム

URL:


 previous next  contents  elements  attributes  index

11 Tables

Contents

  1. Introduction to tables
  2. Elements for constructing tables
    1. TheTABLEelement
    2. Table Captions: TheCAPTION element
    3. Row groups: theTHEAD,TFOOT, andTBODY elements
    4. Column groups: theCOLGROUP andCOL elements
    5. Table rows: TheTR element
    6. Table cells: TheTH andTD elements
  3. Table formatting by visual useragents
    1. Borders and rules
    2. Horizontal and vertical alignment
    3. Cell margins
  4. Table rendering by non-visual useragents
    1. Associating header information withdata cells
    2. Categorizing cells
    3. Algorithm to find headinginformation
  5. Sample table

11.1 Introduction to tables

The HTML table model allows authors to arrange data -- text, preformattedtext, images, links, forms, form fields, other tables, etc. -- into rows andcolumns of cells.

Each table may have an associated caption (see theCAPTION element) that provides a short description of the table'spurpose. A longer description may also be provided (via thesummary attribute) for the benefit of people using speech orBraille-based user agents.

Table rows may be grouped into a head, foot, andbody sections, (via theTHEAD,TFOOT andTBODYelements, respectively). Row groups convey additional structural informationand may be rendered by user agents in ways that emphasize this structure. Useragents may exploit the head/body/foot division to support scrolling of bodysections independently of the head and foot sections. When long tables areprinted, the head and foot information may be repeated on each page thatcontains table data.

Authors may alsogroup columns to provideadditional structural information that may be exploited by user agents.Furthermore, authors may declare column properties at the start of a tabledefinition (via theCOLGROUP andCOL elements) in a way that enablesuser agents to render the table incrementally rather than having to wait forall the table data to arrive before rendering.

Table cells may either contain "header" information(see theTH element) or "data" (see theTD element). Cells may span multiplerows and columns. The HTML 4 table model allows authors to label each cell sothatnon-visual user agents may more easilycommunicate heading information about the cell to the user. Not only do thesemechanisms greatly assist users with visual disabilities, they make it possiblefor multi-modal wireless browsers with limited display capabilities (e.g.,Web-enabled pagers and phones) to handle tables.

Tables should not be used purely as a means to layout document content asthis may present problems when rendering to non-visual media. Additionally,when used with graphics, these tables may force users to scroll horizontally toview a table designed on a system with a larger display. To minimize theseproblems, authors should usestyle sheetsto control layout rather than tables.

Note. This specification includes more detailedinformation about tables in sections ontable design rationale and implementationissues.

Here's a simple table that illustrates some of the features of the HTMLtable model. The following table definition:

<TABLE border="1"          summary="This table gives some statistics about fruit                   flies: average height and weight, and percentage                   with red eyes (for both males and females)."><CAPTION><EM>A test table with merged cells</EM></CAPTION><TR><TH rowspan="2"><TH colspan="2">Average    <TH rowspan="2">Red<BR>eyes<TR><TH>height<TH>weight<TR><TH>Males<TD>1.9<TD>0.003<TD>40%<TR><TH>Females<TD>1.7<TD>0.002<TD>43%</TABLE>

might be rendered something like this on a tty device:

          A test table with merged cells    /-----------------------------------------\    |          |      Average      |   Red    |    |          |-------------------|  eyes    |    |          |  height |  weight |          |    |-----------------------------------------|    |  Males   | 1.9     | 0.003   |   40%    |    |-----------------------------------------|    | Females  | 1.7     | 0.002   |   43%    |    \-----------------------------------------/

or like this by a graphical user agent:

A table with merged cells

11.2 Elements for constructing tables

11.2.1 TheTABLE element

<!ELEMENTTABLE - -     (CAPTION?, (COL*|COLGROUP*), THEAD?, TFOOT?, TBODY+)><!ATTLIST TABLE                        -- table element --%attrs;                              --%coreattrs,%i18n,%events --summary%Text;         #IMPLIED  -- purpose/structure for speech output--width%Length;       #IMPLIED  -- table width --border%Pixels;       #IMPLIED  -- controls frame width around table --frame%TFrame;       #IMPLIED  -- which parts of frame to render --rules%TRules;       #IMPLIED  -- rulings between rows and cols --cellspacing%Length;       #IMPLIED  -- spacing between cells --cellpadding%Length;       #IMPLIED  -- spacing within cells --  >

Start tag:required, End tag:required

Attribute definitions

summary =text[CS]
This attribute provides a summary of the table's purpose and structure foruser agents rendering to non-visual media such as speech and Braille.
align =left|center|right[CI]
Deprecated. Thisattribute specifies the position of the table with respect to the document.Permitted values:
  • left: The table is to the left of the document.
  • center: The table is to the center of the document.
  • right: The table is to the right of the document.
width =length[CN]
This attribute specifies the desired width of the entire table and isintended for visual user agents. When the value is a percentage value, thevalue is relative to the user agent's available horizontal space. In theabsence of any width specification, table width is determined by the useragent.

Attributes defined elsewhere

TheTABLE element contains all other elements that specify caption,rows, content, and formatting.

The following informative list describes what operations user agents maycarry out when rendering a table:

The HTML table model has been designed so that, with author assistance, useragents may render tablesincrementally (i.e., astable rows arrive) rather than having to wait for all the data before beginningto render.

In order for a user agent to format a table in one pass, authors must tellthe user agent:

More precisely, a user agent may render a table in a single pass when thecolumn widths are specified using a combination ofCOLGROUP andCOL elements. If any of the columns are specified inrelative or percentage terms (see the section oncalculating the width of columns), authors must also specify the width ofthe table itself.

Table directionality 

Thedirectionality of a tableis either the inherited directionality (the default is left-to-right) or thatspecified by thedir attribute for theTABLE element.

For a left-to-right table, column zero is on the left side and row zero isat the top. For a right-to-left table, column zero is on the right side and rowzero is at the top.

When a user agent allots extra cells to a row (see the section oncalculating the number of columns in a table), extra rowcells are added to the right of the table for left-to-right tables and to theleft side for right-to-left tables.

Note thatTABLE is the only element on whichdirreverses the visual order of the columns; a single table row (TR) or agroup of columns (COLGROUP) cannot be independently reversed.

When set for theTABLE element, thedir attribute also affects thedirection of text within table cells (since thedir attribute is inherited byblock-level elements).

To specify a right-to-left table, set thedir attribute as follows:

<TABLE dir="RTL">...the rest of the table...</TABLE>

The direction of text in individual cells can be changed by setting thedirattribute in an element that defines the cell. Please consult the section onbidirectional text for more informationon text direction issues.

11.2.2Table Captions: TheCAPTION element

<!ELEMENTCAPTION  - - (%inline;)*     -- table caption --><!ATTLIST CAPTION%attrs;                              --%coreattrs,%i18n,%events --  >

Start tag:required, End tag:required

Attribute definitions

align =top|bottom|left|right[CI]
Deprecated. Forvisual user agents, this attribute specifies the position of the caption withrespect to the table. Possible values:
  • top: The caption is at the top of the table. This is thedefault value.
  • bottom: The caption is at the bottom of the table.
  • left: The caption is at the left of the table.
  • right: The caption is at the right of the table.

Attributes defined elsewhere

When present, theCAPTION element's text shoulddescribe the nature of thetable. TheCAPTION element is only permitted immediately aftertheTABLE start tag. ATABLE element may only contain oneCAPTION element.

Visual user agents allow sighted people to quickly grasp the structure ofthe table from the headings as well as the caption. A consequence of this isthat captions will often be inadequate as a summary of the purpose andstructure of the table from the perspective of people relying on non-visualuser agents.

Authors should therefore take care to provideadditional information summarizing the purpose and structure of thetable using thesummary attribute of theTABLE element. This is especiallyimportant for tables without captions. Examples below illustrate the use of thesummary attribute.

Visual user agents should avoidclipping any part ofthe table including the caption, unless a means is provided to access allparts, e.g., by horizontal or vertical scrolling. We recommend that the captiontext be wrapped to the same width as the table. (See also the section onrecommended layout algorithms.)

11.2.3Row groups: theTHEAD,TFOOT, andTBODY elements

<!ELEMENTTHEAD    - O (TR)+           -- table header --><!ELEMENTTFOOT    - O (TR)+           -- table footer -->

Start tag:required, End tag:optional

<!ELEMENTTBODY    O O (TR)+           -- table body -->

Start tag:optional, End tag:optional

<!ATTLIST (THEAD|TBODY|TFOOT)          -- table section --%attrs;                              --%coreattrs,%i18n,%events --%cellhalign;                         -- horizontal alignment in cells --%cellvalign;                         -- vertical alignment in cells --  >

Attributes defined elsewhere

Table rows may be grouped into a table head, tablefoot, and one or more table body sections, using theTHEAD,TFOOT andTBODY elements, respectively. This division enablesuser agents to support scrolling of table bodies independently of the tablehead and foot. When long tables are printed, the table head and footinformation may be repeated on each page that contains table data.

The table head and table foot should contain information about the table'scolumns. The table body should contain rows of table data.

When present, eachTHEAD,TFOOT, andTBODYcontains arow group. Each row group must contain at least one row,defined by theTR element.

This example illustrates the order and structure of table heads, feet, andbodies.

<TABLE><THEAD>     <TR>...header information...</THEAD><TFOOT>     <TR>...footer information...</TFOOT><TBODY>     <TR>...first row of block one data...     <TR>...second row of block one data...</TBODY><TBODY>     <TR>...first row of block two data...     <TR>...second row of block two data...     <TR>...third row of block two data...</TBODY></TABLE>

TFOOT must appear beforeTBODY within aTABLEdefinition so that user agents can render the foot before receiving all of the(potentially numerous) rows of data. The following summarizes which tags arerequired and which may be omitted:

Conforming user agent parsers must obey these rules for reasons of backwardcompatibility.

The table of the previous example could be shortened by removing certain endtags, as in:

<TABLE><THEAD>     <TR>...header information...<TFOOT>     <TR>...footer information...<TBODY>     <TR>...first row of block one data...     <TR>...second row of block one data...<TBODY>     <TR>...first row of block two data...     <TR>...second row of block two data...     <TR>...third row of block two data...</TABLE>

TheTHEAD,TFOOT, andTBODY sections must contain the same number ofcolumns.

11.2.4Column groups: theCOLGROUP andCOL elements

Column groups allow authors to createstructural divisions within a table. Authors may highlight this structurethrough style sheets or HTML attributes (e.g., therules attribute for theTABLE element). For an example of thevisual presentation of column groups, please consult thesample table.

A table may either contain a single implicit column group (noCOLGROUP element delimits the columns) or any number of explicitcolumn groups (each delimited by an instance of theCOLGROUP element).

TheCOL element allows authors to share attributes among several columnswithout implying any structural grouping. The "span" of theCOLelement is the number of columns that will share the element's attributes.

TheCOLGROUPelement 

<!ELEMENTCOLGROUP - O (COL)*          -- table column group --><!ATTLIST COLGROUP%attrs;                              --%coreattrs,%i18n,%events --spanNUMBER         1         -- default number of columns in group --width%MultiLength;  #IMPLIED  -- default width for enclosed COLs --%cellhalign;                         -- horizontal alignment in cells --%cellvalign;                         -- vertical alignment in cells --  >

Start tag:required, End tag:optional

Attribute definitions

span =number[CN]
This attribute, which must be an integer > 0, specifies the number ofcolumns in a column group. Values mean the following:
  • In the absence of aspan attribute, eachCOLGROUP defines a column group containing one column.
  • If thespan attribute is set to N > 0, the currentCOLGROUP element defines a column group containing N columns.

User agents must ignore this attribute if theCOLGROUP element contains one or moreCOL elements.

width =multi-length[CN]

This attribute specifies a default width for each column in the currentcolumn group. In addition to the standard pixel, percentage, and relativevalues, this attribute allows the special form "0*" (zero asterisk) which meansthat the width of the each column in the group should be the minimum widthnecessary to hold the column's contents. This implies that a column's entirecontents must be known before its width may be correctly computed. Authorsshould be aware that specifying "0*" will prevent visual user agents fromrendering a table incrementally.

This attribute is overridden for any column in the column group whosewidth is specified via aCOL element.

Attributes defined elsewhere

TheCOLGROUP element creates an explicit column group. The number ofcolumns in the column group may be specified in two, mutually exclusiveways:

  1. The element'sspan attribute (default value 1) specifiesthe number of columns in the group.
  2. EachCOL element in theCOLGROUP represents one or more columnsin the group.

The advantage of using thespan attribute is that authorsmay group together information about column widths. Thus, if a table containsforty columns, all of which have a width of 20 pixels, it is easier towrite:

   <COLGROUP span="40" width="20">   </COLGROUP>

than:

   <COLGROUP>      <COL width="20">      <COL width="20">...a total of forty COL elements...   </COLGROUP>

When it is necessary to single out a column (e.g., for style information, tospecify width information, etc.) within a group, authors must identify thatcolumn with aCOL element. Thus, to apply special style information to thelast column of the previous table, we single it out as follows:

   <COLGROUP width="20">      <COL span="39">      <COL>   </COLGROUP>

Thewidth attribute of theCOLGROUP element is inherited by all 40 columns. The firstCOLelement refers to the first 39 columns (doing nothing special to them) and thesecond one assigns anid value to the fortieth column so that style sheets mayrefer to it.

The table in the following example contains two column groups. The firstcolumn group contains 10 columns and the second contains 5 columns. The defaultwidth for each column in the first column group is 50 pixels. The width of eachcolumn in the second column group will be the minimum required for thatcolumn.

<TABLE><COLGROUP span="10" width="50"><COLGROUP span="5" width="0*"><THEAD><TR><TD>...</TABLE>

TheCOL element 

<!ELEMENTCOL      - O EMPTY           -- table column --><!ATTLIST COL                          -- column groups and properties --%attrs;                              --%coreattrs,%i18n,%events --spanNUMBER         1         -- COL attributes affect N columns --width%MultiLength;  #IMPLIED  -- column width specification --%cellhalign;                         -- horizontal alignment in cells --%cellvalign;                         -- vertical alignment in cells --  >

Start tag:required, End tag:forbidden

Attribute definitions

span =number[CN]
This attribute, whose value must be an integer > 0, specifies the numberof columns "spanned" by theCOL element; theCOL element shares its attributes withall the columns it spans. The default value for this attribute is 1 (i.e., theCOL element refers to a single column). If thespan attribute is set to N > 1, the currentCOLelement shares its attributes with the next N-1 columns.
width =multi-length[CN]
This attribute specifies a default width for each column spanned by thecurrentCOL element. It has the same meaning as thewidth attribute for theCOLGROUP element and overrides it.

Attributes defined elsewhere

TheCOL element allows authors to group together attributespecifications for table columns. TheCOL doesnot groupcolumns together structurally -- that is the role of theCOLGROUP element.COL elements are empty and serve only as asupport for attributes. They may appear inside or outside an explicit columngroup (i.e.,COLGROUP element).

Thewidth attribute forCOL refers to the width of eachcolumn in the element's span.

Calculating the number of columns in atable 

There are two ways to determine the number of columns in a table (in orderof precedence):

  1. If theTABLE element contains anyCOLGROUP orCOLelements, user agents should calculate the number of columns by summing thefollowing:
  2. Otherwise, if theTABLE element contains noCOLGROUP orCOL elements, user agents should base the number ofcolumns on what is required by the rows. The number of columns is equal to thenumber of columns required by the row with the most columns, including cellsthat span multiple columns. For any row that has fewer than this number ofcolumns, the end of that row should be padded with empty cells. The "end" of arow depends on thetabledirectionality.

It is an error if a table containsCOLGROUP orCOLelements and the two calculations do not result in the same number ofcolumns.

Once the user agent has calculated the number of columns in the table, itmay group them intocolumn groups.

For example, for each of the following tables, the two column calculationmethods should result in three columns. The first three tables may be renderedincrementally.

<TABLE><COLGROUP span="3"></COLGROUP><TR><TD>......rows...</TABLE><TABLE><COLGROUP><COL><COL span="2"></COLGROUP><TR><TD>......rows...</TABLE><TABLE><COLGROUP><COL></COLGROUP><COLGROUP span="2"><TR><TD>......rows...</TABLE><TABLE><TR>  <TD><TD><TD></TR></TABLE>

Calculating the width of columns 

Authors may specify column widths in three ways:

Fixed
A fixed width specification is given in pixels (e.g.,width="30"). A fixed-width specification enables incrementalrendering.
Percentage
A percentage specification (e.g.,width="20%")is based on the percentage of the horizontal space available to the table(between the current left and right margins, including floats). Note that thisspace does not depend on the table itself, and thus percentage specificationsenable incremental rendering.
Proportional
Proportional specifications (e.g.,width="3*")refer to portions of the horizontal spacerequired by a table. If thetable width is given a fixed value via thewidthattribute of theTABLE element, user agents may render the tableincrementally even with proportional columns.

However, if the table does not have a fixed width, user agents must receiveall table data before they can determine the horizontal space required by thetable. Only then may this space be allotted to proportional columns.

If an author specifies no width information for a column, a user agent maynot be able to incrementally format the table since it must wait for the entirecolumn of data to arrive in order to allot an appropriate width.

If column widths prove to be too narrow for the contents of a particulartable cell, user agents may choose to reflow the table.

The table in this example contains six columns. The first one does notbelong to an explicit column group. The next three belong to the first explicitcolumn group and the last two belong to the second explicit column group. Thistable cannot be formatted incrementally since it contains proportional columnwidth specifications and no value for thewidth attribute for theTABLE element.

Once the (visual) user agent has received the table's data: the availablehorizontal space will be alloted by the user agent as follows: First the useragent will allot 30 pixels to columns one and two. Then, the minimal spacerequired for the third column will be reserved. The remaining horizontal spacewill be divided into six equal portions (since 2* + 1* + 3* = 6 portions).Column four (2*) will receive two of these portions, column five (1*) willreceive one, and column six (3*) will receive three.

    <TABLE><COLGROUP>   <COL width="30"><COLGROUP>   <COL width="30">   <COL width="0*">   <COL width="2*"><COLGROUP align="center">   <COL width="1*">   <COL width="3*" align="char" char=":"><THEAD><TR><TD>......rows...</TABLE>

We have set the value of thealign attribute in the third columngroup to "center". All cells in every column in this group will inherit thisvalue, but may override it. In fact, the finalCOL does just that, by specifyingthat every cell in the column it governs will be aligned along the ":"character.

In the following table, the column width specifications allow the user agentto format the table incrementally:

    <TABLE width="200"><COLGROUP span="10" width="15"><COLGROUP width="*">   <COL>   <COL><THEAD><TR><TD>......rows...</TABLE>

The first ten columns will be 15 pixels wide each. The last two columns willeach receive half of the remaining 50 pixels. Note that theCOLelements appear only so that anid value may be specified for the last twocolumns.

Note. Although thewidth attribute on theTABLE element is not deprecated,authors are encouraged to use style sheets to specify table widths.

11.2.5Table rows: TheTR element

<!ELEMENTTR       - O (TH|TD)+        -- table row --><!ATTLIST TR                           -- table row --%attrs;                              --%coreattrs,%i18n,%events --%cellhalign;                         -- horizontal alignment in cells --%cellvalign;                         -- vertical alignment in cells --  >

Start tag:required, End tag:optional

Attributes defined elsewhere

TheTR elements acts as a container for a row of table cells. The endtag may be omitted.

This sample table contains three rows, each begun by theTRelement:

<TABLE summary="This table charts the number of cups                   of coffee consumed by each senator, the type                    of coffee (decaf or regular), and whether                    taken with sugar."><CAPTION>Cups of coffee consumed by each senator</CAPTION><TR>...A header row...<TR>...First row of data...<TR>...Second row of data......the rest of the table...</TABLE>

11.2.6Table cells: TheTH andTD elements

<!ELEMENT (TH|TD)  - O (%flow;)*       -- table header cell, table data cell--><!-- Scope is simpler than headers attribute for common tables --><!ENTITY % Scope "(row|col|rowgroup|colgroup)"><!-- TH is for headers, TD for data, but for cells acting as both use TD --><!ATTLIST (TH|TD)                      -- header or data cell --%attrs;                              --%coreattrs,%i18n,%events --abbr%Text;         #IMPLIED  -- abbreviation for header cell --axisCDATA          #IMPLIED  -- comma-separated list of related headers--headersIDREFS         #IMPLIED  -- list of id's for header cells --scope%Scope;        #IMPLIED  -- scope covered by header cells --rowspanNUMBER         1         -- number of rows spanned by cell --colspanNUMBER         1         -- number of cols spanned by cell --%cellhalign;                         -- horizontal alignment in cells --%cellvalign;                         -- vertical alignment in cells --  >

Start tag:required, End tag:optional

Attribute definitions

headers =idrefs[CS]
This attribute specifies the list of header cells that provide headerinformation for the current data cell. The value of this attribute is aspace-separated list of cell names; those cells must be named by setting theiridattribute. Authors generally use theheaders attribute to help non-visualuser agents render header information about data cells (e.g., headerinformation is spoken prior to the cell data), but the attribute may also beused in conjunction with style sheets. See also thescopeattribute.
scope =scope-name[CI]
This attribute specifies the set of data cells for which the current headercell provides header information. This attribute may be used in place of theheaders attribute, particularly for simple tables. When specified,this attribute must have one of the following values:
  • row: The current cell provides header information for therest of the row that contains it (see also the section ontable directionality).
  • col: The current cell provides header information for therest of the column that contains it.
  • rowgroup: The header cell provides header information forthe rest of therow group that contains it.
  • colgroup: The header cell provides header information forthe rest of thecolumn group that contains it.
abbr =text[CS]
This attribute should be used to provide an abbreviated form of the cell'scontent, and may be rendered by user agents when appropriate in place of thecell's content. Abbreviated names should be short since user agents may renderthem repeatedly. For instance, speech synthesizers may render the abbreviatedheaders relating to a particular cell before rendering that cell'scontent.
axis =cdata[CI]
This attribute may be used to place a cell into conceptual categories thatcan be considered to form axes in an n-dimensional space. User agents may giveusers access to these categories (e.g., the user may query the user agent forall cells that belong to certain categories, the user agent may present a tablein the form of a table of contents, etc.). Please consult the section oncategorizing cells for more information. The valueof this attribute is a comma-separated list of category names.
rowspan =number[CN]
This attribute specifies the number of rows spanned by the current cell.The default value of this attribute is one ("1"). The value zero ("0") meansthat the cell spans all rows from the current row to the last row of the tablesection (THEAD,TBODY, orTFOOT) in which the cell isdefined.
colspan =number[CN]
This attribute specifies the number of columns spanned by the current cell.The default value of this attribute is one ("1"). The value zero ("0") meansthat the cell spans all columns from the current column to the last column ofthe column group (COLGROUP) in which the cell is defined.
nowrap[CI]
Deprecated. Whenpresent, this boolean attribute tells visual user agents to disable automatictext wrapping for this cell.Style sheetsshould be used instead of this attribute to achieve wrapping effects.Note. if used carelessly, this attribute may result in excessivelywide cells.
width =length[CN]
Deprecated. Thisattribute supplies user agents with a recommended cell width.
height =length[CN]
Deprecated. Thisattribute supplies user agents with a recommended cell height.

Attributes defined elsewhere

Table cells may contain two types of information:headerinformation anddata. Thisdistinction enables user agents to render header and data cells distinctly,even in the absence of style sheets. For example, visual user agents maypresent header cell text with a bold font. Speech synthesizers may renderheader information with a distinct voice inflection.

TheTH element defines a cell that contains header information. Useragents have two pieces of header information available: the contents of theTHelement and the value of theabbr attribute. User agents must render eitherthe contents of the cell or the value of theabbr attribute. For visual media,the latter may be appropriate when there is insufficient space to render thefull contents of the cell. For non-visual mediaabbr may be used as anabbreviation for table headers when these are rendered along with the contentsof the cells to which they apply.

Theheaders andscope attributes also allow authors to help non-visualuser agents process header information. Please consult the section onlabeling cells for non-visual user agents forinformation and examples.

TheTD element defines a cell that contains data.

Cells may be empty (i.e., contain no data).

For example, the following table contains four columns of data, each headedby a column description.

<TABLE summary="This table charts the number of cups                   of coffee consumed by each senator, the type                    of coffee (decaf or regular), and whether                    taken with sugar."><CAPTION>Cups of coffee consumed by each senator</CAPTION><TR>   <TH>Name</TH>   <TH>Cups</TH>   <TH>Type of Coffee</TH>   <TH>Sugar?</TH><TR>   <TD>T. Sexton</TD>   <TD>10</TD>   <TD>Espresso</TD>   <TD>No</TD><TR>   <TD>J. Dinnen</TD>   <TD>5</TD>   <TD>Decaf</TD>   <TD>Yes</TD></TABLE>

A user agent rendering to a tty device might display this as follows:

Name         Cups       Type of Coffee   Sugar?T. Sexton    10         Espresso         NoJ. Dinnen    5          Decaf            Yes

Cells that span several rows orcolumns 

Cells may span several rows or columns. The number of rows or columnsspanned by a cell is set by therowspan andcolspan attributes for theTH andTD elements.

In this table definition, we specify that the cell in row four, column twoshould span a total of three columns, including the current column.

<TABLE border="1"><CAPTION>Cups of coffee consumed by each senator</CAPTION><TR><TH>Name<TH>Cups<TH>Type of Coffee<TH>Sugar?<TR><TD>T. Sexton<TD>10<TD>Espresso<TD>No<TR><TD>J. Dinnen<TD>5<TD>Decaf<TD>Yes<TR><TD>A. Soria<TD colspan="3"><em>Not available</em></TABLE>

This table might be rendered on a tty device by a visual user agent asfollows:

Cups of coffee consumed by each senator -------------------------------------- |   Name  |Cups|Type of Coffee|Sugar?| -------------------------------------- |T. Sexton|10  |Espresso      |No    | -------------------------------------- |J. Dinnen|5   |Decaf         |Yes   | -------------------------------------- |A. Soria |Not available             | --------------------------------------

The next example illustrates (with the help of table borders) how celldefinitions that span more than one row or column affect the definition oflater cells. Consider the following table definition:

<TABLE border="1"><TR><TD>1 <TD rowspan="2">2 <TD>3<TR><TD>4 <TD>6<TR><TD>7 <TD>8 <TD>9</TABLE>

As cell "2" spans the first and second rows, the definition of the secondrow will take it into account. Thus, the secondTD in row two actually definesthe row's third cell. Visually, the table might be rendered to a tty deviceas:

-------------| 1 | 2 | 3 | ----|   |----| 4 |   | 6 |----|---|----| 7 | 8 | 9 |-------------

while a graphical user agent might render this as:

Image of a table with rowspan=2

Note that if theTD defining cell "6" had been omitted, an extra empty cellwould have been added by the user agent to complete the row.

Similarly, in the following table definition:

<TABLE border="1"><TR><TD>1 <TD>2 <TD>3<TR><TD colspan="2">4 <TD>6<TR><TD>7 <TD>8 <TD>9</TABLE>

cell "4" spans two columns, so the secondTD in the row actually definesthe third cell ("6"):

-------------| 1 | 2 | 3 | --------|----| 4     | 6 |--------|----| 7 | 8 | 9 |-------------

A graphical user agent might render this as:

Image of a table with colspan=2

Defining overlapping cells is an error. User agents may vary in how theyhandle this error (e.g., rendering may vary).

The following illegal example illustrates how one might create overlappingcells. In this table, cell "5" spans two rows and cell "7" spans two columns,so there is overlap in the cell between "7" and "9":

<TABLE border="1"><TR><TD>1 <TD>2 <TD>3<TR><TD>4 <TD rowspan="2">5 <TD>6<TR><TD colspan="2">7 <TD>9</TABLE>

11.3Table formatting by visual useragents

Note. The following sections describe the HTML tableattributes that concern visual formatting. When this specification was firstpublished in 1997,[CSS1] did not offer mechanisms to control all aspects ofvisual table formatting. Since then,[CSS2] has added propertiesto allow visual formatting of tables.

HTML 4 includes mechanisms to control:

11.3.1Borders and rules

The following attributes affect a table's external frame and internalrules.

Attribute definitions

frame =void|above|below|hsides|lhs|rhs|vsides|box|border[CI]
This attribute specifies which sides of the frame surrounding a table willbe visible. Possible values:
  • void: No sides. This is the default value.
  • above: The top side only.
  • below: The bottom side only.
  • hsides: The top and bottom sides only.
  • vsides: The right and left sides only.
  • lhs: The left-hand side only.
  • rhs: The right-hand side only.
  • box: All four sides.
  • border: All four sides.
rules =none|groups|rows|cols|all[CI]
This attribute specifies which rules will appear between cells within atable. The rendering of rules is user agent dependent. Possible values:
  • none: No rules. This is the default value.
  • groups: Rules will appear between row groups (seeTHEAD,TFOOT, andTBODY) and column groups (seeCOLGROUP andCOL) only.
  • rows: Rules will appear between rows only.
  • cols: Rules will appear between columns only.
  • all: Rules will appear between all rows and columns.
border =pixels[CN]
This attributes specifies the width (in pixels only) of the frame around atable (see the Note below for more information about this attribute).

To help distinguish the cells of a table, we can set theborder attribute of theTABLE element. Consider a previousexample:

<TABLE border="1"        summary="This table charts the number of cups                of coffee consumed by each senator, the type                 of coffee (decaf or regular), and whether                 taken with sugar."><CAPTION>Cups of coffee consumed by each senator</CAPTION><TR>   <TH>Name</TH>   <TH>Cups</TH>   <TH>Type of Coffee</TH>   <TH>Sugar?</TH><TR>   <TD>T. Sexton</TD>   <TD>10</TD>   <TD>Espresso</TD>   <TD>No</TD><TR>   <TD>J. Dinnen</TD>   <TD>5</TD>   <TD>Decaf</TD>   <TD>Yes</TD></TABLE>

In the following example, the user agent should show borders five pixelsthick on the left-hand and right-hand sides of the table, with rules drawnbetween each column.

<TABLE border="5" frame="vsides" rules="cols"><TR> <TD>1 <TD>2 <TD>3<TR> <TD>4 <TD>5 <TD>6<TR> <TD>7 <TD>8 <TD>9</TABLE>

The following settings should be observed by user agents for backwardscompatibility.

For example, the following definitions are equivalent:

<TABLE border="2"><TABLE border="2" frame="border" rules="all">

as are the following:

<TABLE border><TABLE frame="border" rules="all">

Note. Theborder attribute also defines theborder behavior for theOBJECT andIMG elements, but takes differentvalues for those elements.

11.3.2Horizontal and vertical alignment

The following attributes may be set for different table elements (see theirdefinitions).

<!-- horizontal alignment attributes for cell contents --><!ENTITY % cellhalign  "align      (left|center|right|justify|char) #IMPLIEDchar%Character;    #IMPLIED  -- alignment char, e.g. char=':' --charoff%Length;       #IMPLIED  -- offset for alignment char --"  ><!-- vertical alignment attributes for cell contents --><!ENTITY % cellvalign  "valign     (top|middle|bottom|baseline) #IMPLIED"  >

Attribute definitions

align =left|center|right|justify|char[CI]
This attribute specifies the alignment of data and the justification oftext in a cell. Possible values:
  • left: Left-flush data/Left-justify text. This is the defaultvalue for table data.
  • center: Center data/Center-justify text. This is the defaultvalue for table headers.
  • right: Right-flush data/Right-justify text.
  • justify: Double-justify text.
  • char: Align text around a specific character. If a user agentdoesn't support character alignment, behavior in the presence of this value isunspecified.
valign =top|middle|bottom|baseline[CI]
This attribute specifies the vertical position of data within a cell.Possible values:
  • top: Cell data is flush with the top of the cell.
  • middle: Cell data is centered vertically within the cell. Thisis the default value.
  • bottom: Cell data is flush with the bottom of the cell.
  • baseline: All cells in the same row as a cell whosevalign attribute has this value should have their textual datapositioned so that the first text line occurs on a baseline common to all cellsin the row. This constraint does not apply to subsequent text lines in thesecells.
char =character[CN]
This attribute specifies a single character within a text fragment to actas an axis for alignment. The default value for this attribute is the decimalpoint character for the current language as set by thelangattribute (e.g., the period (".") in English and the comma (",") in French).User agents are not required to support this attribute.
charoff =length[CN]
When present, this attribute specifies the offset to the first occurrenceof the alignment character on each line. If a line doesn't include thealignment character, it should be horizontally shifted to end at the alignmentposition.

Whencharoff is used to set the offset of an alignment character, thedirection of offset is determined by the current text direction (set by thedirattribute). In left-to-right texts (the default), offset is from the leftmargin. In right-to-left texts, offset is from the right margin. User agentsare not required to support this attribute.

The table in this example aligns a row of currency values along a decimalpoint. We set the alignment character to "." explicitly.

<TABLE border="1"><COLGROUP><COL><COL align="char" char="."><THEAD><TR><TH>Vegetable <TH>Cost per kilo<TBODY><TR><TD>Lettuce        <TD>$1<TR><TD>Silver carrots <TD>$10.50<TR><TD>Golden turnips <TD>$100.30</TABLE>

The formatted table may resemble the following:

------------------------------|   Vegetable  |Cost per kilo||--------------|-------------||Lettuce       |        $1   ||--------------|-------------||Silver carrots|       $10.50||--------------|-------------||Golden turnips|      $100.30|------------------------------

When the contents of a cell contain more than one instance of the alignmentcharacter specified bychar and the contents wrap, user agent behavior isundefined. Authors should therefore be attentive in their use ofchar.

Note. Visual user agents typically renderTH elementsvertically and horizontally centered within the cell and with a bold fontweight.

Inheritance of alignmentspecifications 

The alignment of cell contents can be specified on a cell by cell basis, orinherited from enclosing elements, such as the row, column or the tableitself.

The order of precedence (from highest to lowest) for the attributesalign,char, andcharoff is the following:

  1. An alignment attribute set on an element within a cell's data (e.g.,P).
  2. An alignment attribute set on a cell (TH andTD).
  3. An alignment attribute set on a column grouping element (COL andCOLGROUP). When a cell is part of a multi-column span, the alignmentproperty is inherited from the cell definition at the beginning of thespan.
  4. An alignment attribute set on a row or row grouping element (TR,THEAD,TFOOT, andTBODY). When a cell is part of a multi-row span,the alignment property is inherited from the cell definition at the beginningof the span.
  5. An alignment attribute set on the table (TABLE).
  6. The default alignment value.

The order of precedence (from highest to lowest) for the attributevalign(as well as the other inherited attributeslang,dir, andstyle) is the following:

  1. An attribute set on an element within a cell's data (e.g.,P).
  2. An attribute set on a cell (TH andTD).
  3. An attribute set on a row or row grouping element (TR,THEAD,TFOOT, andTBODY). When a cell is part of a multi-row span,the attribute value is inherited from the cell definition at the beginning ofthe span.
  4. An attribute set on a column grouping element (COL andCOLGROUP). When a cell is part of a multi-column span, the attributevalue is inherited from the cell definition at the beginning of the span.
  5. An attribute set on the table (TABLE).
  6. The default attribute value.

Furthermore, when rendering cells, horizontal alignment is determined bycolumns in preference to rows, while for vertical alignment, rows are givenpreference over columns.

The default alignment for cells depends on the user agent. However, useragents should substitute the default attribute for the current directionality(i.e., not just "left" in all cases).

User agents that do not support the "justify" value of thealign attribute should use the value of the inherited directionalityin its place.

Note. Note that a cell may inherit anattribute not from its parent but from the first cell in a span. This is anexception to the general attribute inheritance rules.

11.3.3Cellmargins

Attribute definitions

cellspacing =length[CN]
This attribute specifies how much space the user agent should leave betweenthe left side of the table and the left-hand side of the leftmost column, thetop of the table and the top side of the topmost row, and so on for the rightand bottom of the table. The attribute also specifies the amount of space toleave between cells.
cellpadding =length[CN]
This attribute specifies the amount of space between the border of the celland its contents. If the value of this attribute is a pixel length, all fourmargins should be this distance from the contents. If the value of theattribute is a percentage length, the top and bottom margins should be equallyseparated from the content based on a percentage of the available verticalspace, and the left and right margins should be equally separated from thecontent based on a percentage of the available horizontal space.

These two attributes control spacing between and within cells. The followingillustration explains how they relate:

Image illustrating how cellspacing and cellpadding attributes relate.

In the following example, thecellspacing attribute specifies thatcells should be separated from each other and from the table frame by twentypixels. Thecellpadding attribute specifies that the top margin of thecell and the bottom margin of the cell will each be separated from the cell'scontents by 10% of the available vertical space (the total being 20%).Similarly, the left margin of the cell and the right margin of the cell willeach be separated from the cell's contents by 10% of the available horizontalspace (the total being 20%).

<TABLE cellspacing="20" cellpadding="20%"><TR> <TD>Data1 <TD>Data2 <TD>Data3</TABLE>

If a table or given column has a fixed width,cellspacing andcellpadding may demand more space thanassigned. User agents may give these attributes precedence over thewidth attribute when a conflict occurs, but are not required to.

11.4Table rendering by non-visual useragents

11.4.1Associating headerinformation with data cells

Non-visual user agents such as speech synthesizers and Braille-based devicesmay use the followingTD andTH element attributes to render table cells moreintuitively:

In the following example, we assign header information to cells by settingtheheaders attribute. Each cell in the same column refers to the sameheader cell (via theid attribute).

<TABLE border="1"        summary="This table charts the number of cups                of coffee consumed by each senator, the type                 of coffee (decaf or regular), and whether                 taken with sugar."><CAPTION>Cups of coffee consumed by each senator</CAPTION><TR>   <TH>Name</TH>   <TH>Cups</TH>   <TH abbr="Type">Type of Coffee</TH>   <TH>Sugar?</TH><TR>   <TD headers="t1">T. Sexton</TD>   <TD headers="t2">10</TD>   <TD headers="t3">Espresso</TD>   <TD headers="t4">No</TD><TR>   <TD headers="t1">J. Dinnen</TD>   <TD headers="t2">5</TD>   <TD headers="t3">Decaf</TD>   <TD headers="t4">Yes</TD></TABLE>

A speech synthesizer might render this table as follows:

Caption: Cups of coffee consumed by each senatorSummary: This table charts the number of cups         of coffee consumed by each senator, the type          of coffee (decaf or regular), and whether          taken with sugar.Name: T. Sexton,   Cups: 10,   Type: Espresso,   Sugar: NoName: J. Dinnen,   Cups: 5,    Type: Decaf,      Sugar: Yes

Note how the header "Type of Coffee" is abbreviated to "Type" using theabbrattribute.

Here is the same example substituting thescope attribute for theheaders attribute. Note the value "col" for thescopeattribute, meaning "all cells in the current column":

<TABLE border="1"        summary="This table charts the number of cups                of coffee consumed by each senator, the type                 of coffee (decaf or regular), and whether                 taken with sugar."><CAPTION>Cups of coffee consumed by each senator</CAPTION><TR>   <TH scope="col">Name</TH>   <TH scope="col">Cups</TH>   <TH scope="col" abbr="Type">Type of Coffee</TH>   <TH scope="col">Sugar?</TH><TR>   <TD>T. Sexton</TD>   <TD>10</TD>   <TD>Espresso</TD>   <TD>No</TD><TR>   <TD>J. Dinnen</TD>   <TD>5</TD>   <TD>Decaf</TD>   <TD>Yes</TD></TABLE>

Here's a somewhat more complex example illustrating other values for thescope attribute:

<TABLE border="1" cellpadding="5" cellspacing="2"  summary="History courses offered in the community of           Bath arranged by course name, tutor, summary,            code, and fee">  <TR>    <TH colspan="5" scope="colgroup">Community Courses -- Bath Autumn 1997</TH>  </TR>  <TR>    <TH scope="col" abbr="Name">Course Name</TH>    <TH scope="col" abbr="Tutor">Course Tutor</TH>    <TH scope="col">Summary</TH>    <TH scope="col">Code</TH>    <TH scope="col">Fee</TH>  </TR>  <TR>    <TD scope="row">After the Civil War</TD>    <TD>Dr. John Wroughton</TD>    <TD>       The course will examine the turbulent years in England       after 1646. <EM>6 weekly meetings starting Monday 13th      October.</EM>    </TD>    <TD>H27</TD>    <TD>&pound;32</TD>  </TR>  <TR>    <TD scope="row">An Introduction to Anglo-Saxon England</TD>    <TD>Mark Cottle</TD>    <TD>       One day course introducing the early medieval       period reconstruction the Anglo-Saxons and       their society. <EM>Saturday 18th October.</EM>    </TD>    <TD>H28</TD>    <TD>&pound;18</TD>  </TR>  <TR>    <TD scope="row">The Glory that was Greece</TD>    <TD>Valerie Lorenz</TD>    <TD>     Birthplace of democracy, philosophy, heartland of theater, home of     argument. The Romans may have done it but the Greeks did it     first. <EM>Saturday day school 25th October 1997</EM>    </TD>    <TD>H30</TD>    <TD>&pound;18</TD>  </TR></TABLE>

A graphical user agent might render this as:

A table with merged cells

Note the use of thescope attribute with the "row" value. Although thefirst cell in each row contains data, not header information, thescopeattribute makes the data cell behave like a row header cell. This allows speechsynthesizers to provide the relevant course name upon request or to state itimmediately before each cell's content.

11.4.2Categorizingcells

Users browsing a table with a speech-based user agent may wish to hear anexplanation of a cell's contents in addition to the contents themselves. Oneway the user might provide an explanation is by speaking associated headerinformation before speaking the data cell's contents (see the section onassociating header information with data cells).

Users may also want information about more than one cell, in which caseheader information provided at the cell level (byheaders,scope, andabbr) may not provide adequate context.Consider the following table, which classifies expenses for meals, hotels, andtransport in two locations (San Jose and Seattle) over several days:

Image of a table listing travel expenses at two locations: San Jose and Seattle, by date, and category (meals, hotels, and transport), shown with subtitles

Users might want to extract information from the table in the form ofqueries:

Each query involves a computation by the user agent that may involve zero ormore cells. In order to determine, for example, the costs of meals on 25August, the user agent must know which table cells refer to "Meals" (all ofthem) and which refer to "Dates" (specifically, 25 August), and find theintersection of the two sets.

To accommodate this type of query, the HTML 4 table model allows authors toplace cell headers and data into categories. For example, for the travelexpense table, an author could group the header cells "San Jose" and "Seattle"into the category "Location", the headers "Meals", "Hotels", and "Transport" inthe category "Expenses", and the four days into the category "Date". Theprevious three questions would then have the following meanings:

Authors categorize a header or data cell by setting theaxisattribute for the cell. For instance, in the travel expense table, the cellcontaining the information "San Jose" could be placed in the "Location"category as follows:

  <TH axis="location">San Jose</TH>

Any cell containing information related to "San Jose" should refer to thisheader cell via either theheaders or thescope attribute. Thus, mealexpenses for 25-Aug-1997 should be marked up to refer toidattribute (whose value here is "a6") of the "San Jose" header cell:

    <TD headers="a6">37.74</TD>

Eachheaders attribute provides a list ofid references. Authors may thuscategorize a given cell in any number of ways (or, along any number of"headers", hence the name).

Below we mark up the travel expense table with category information:

<TABLE border="1"          summary="This table summarizes travel expenses                   incurred during August trips to                   San Jose and Seattle"><CAPTION>  Travel Expense Report</CAPTION><TR>  <TH></TH>  <TH axis="expenses">Meals</TH>  <TH axis="expenses">Hotels</TH>  <TH axis="expenses">Transport</TH>  <TD>subtotals</TD></TR><TR>  <TH axis="location">San Jose</TH>  <TH></TH>  <TH></TH>  <TH></TH>  <TD></TD></TR><TR>  <TD axis="date">25-Aug-97</TD>  <TD headers="a6 a7 a2">37.74</TD>  <TD headers="a6 a7 a3">112.00</TD>  <TD headers="a6 a7 a4">45.00</TD>  <TD></TD></TR><TR>  <TD axis="date">26-Aug-97</TD>  <TD headers="a6 a8 a2">27.28</TD>  <TD headers="a6 a8 a3">112.00</TD>  <TD headers="a6 a8 a4">45.00</TD>  <TD></TD></TR><TR>  <TD>subtotals</TD>  <TD>65.02</TD>  <TD>224.00</TD>  <TD>90.00</TD>  <TD>379.02</TD></TR><TR>  <TH axis="location">Seattle</TH>  <TH></TH>  <TH></TH>  <TH></TH>  <TD></TD></TR><TR>  <TD axis="date">27-Aug-97</TD>  <TD headers="a10 a11 a2">96.25</TD>  <TD headers="a10 a11 a3">109.00</TD>  <TD headers="a10 a11 a4">36.00</TD>  <TD></TD></TR><TR>  <TD axis="date">28-Aug-97</TD>  <TD headers="a10 a12 a2">35.00</TD>  <TD headers="a10 a12 a3">109.00</TD>  <TD headers="a10 a12 a4">36.00</TD>  <TD></TD></TR><TR>  <TD>subtotals</TD>  <TD>131.25</TD>  <TD>218.00</TD>  <TD>72.00</TD>  <TD>421.25</TD></TR><TR>  <TH>Totals</TH>  <TD>196.27</TD>  <TD>442.00</TD>  <TD>162.00</TD>  <TD>800.27</TD></TR></TABLE>

Note that marking up the table this way also allows user agents to avoidconfusing the user with unwanted information. For instance, if a speechsynthesizer were to speak all of the figures in the "Meals" column of thistable in response to the query "What were all my meal expenses?", a user wouldnot be able to distinguish a day's expenses from subtotals or totals. Bycarefully categorizing cell data, authors allow user agents to make importantsemantic distinctions when rendering.

Of course, there is no limit to how authors may categorize information in atable. In the travel expense table, for example, we could add the additionalcategories "subtotals" and "totals".

This specification does not require user agents to handle informationprovided by theaxis attribute, nor does it make any recommendations abouthow user agents may presentaxis information to users or how users may querythe user agent about this information.

However, user agents, particularly speechsynthesizers, may want to factor out information common to severalcells that are the result of a query. For instance, if the user asks "What didI spend for meals in San Jose?", the user agent would first determine the cellsin question (25-Aug-1997: 37.74, 26-Aug-1997:27.28), then render thisinformation. A user agent speaking this information might read it:

   Location: San Jose. Date: 25-Aug-1997. Expenses, Meals: 37.74   Location: San Jose. Date: 26-Aug-1997. Expenses, Meals: 27.28

or, more compactly:

   San Jose, 25-Aug-1997, Meals: 37.74   San Jose, 26-Aug-1997, Meals: 27.28

An even more economical rendering would factor the common information andreorder it:

   San Jose, Meals, 25-Aug-1997: 37.74                    26-Aug-1997: 27.28

User agents that support this type of rendering should allow user agents ameans to customize rendering (e.g., through style sheets).

11.4.3Algorithm to findheading information

In the absence of header information from either thescope orheaders attribute, user agents may construct header informationaccording to the following algorithm. The goal of the algorithm is to find anordered list of headers. (In the following description of the algorithm thetable directionality is assumed to beleft-to-right.)

11.5Sample table

This sample illustrates grouped rows and columns. The example is adaptedfrom "Developing International Software", by Nadine Kano.

In "ascii art", the following table:

<TABLE border="2" frame="hsides" rules="groups"          summary="Code page support in different versions                   of MS Windows."><CAPTION>CODE-PAGE SUPPORT IN MICROSOFT WINDOWS</CAPTION><COLGROUP align="center"><COLGROUP align="left"><COLGROUP align="center" span="2"><COLGROUP align="center" span="3"><THEAD valign="top"><TR><TH>Code-Page<BR>ID<TH>Name<TH>ACP<TH>OEMCP<TH>Windows<BR>NT 3.1<TH>Windows<BR>NT 3.51<TH>Windows<BR>95<TBODY><TR><TD>1200<TD>Unicode (BMP of ISO/IEC-10646)<TD><TD><TD>X<TD>X<TD>*<TR><TD>1250<TD>Windows 3.1 Eastern European<TD>X<TD><TD>X<TD>X<TD>X<TR><TD>1251<TD>Windows 3.1 Cyrillic<TD>X<TD><TD>X<TD>X<TD>X<TR><TD>1252<TD>Windows 3.1 US (ANSI)<TD>X<TD><TD>X<TD>X<TD>X<TR><TD>1253<TD>Windows 3.1 Greek<TD>X<TD><TD>X<TD>X<TD>X<TR><TD>1254<TD>Windows 3.1 Turkish<TD>X<TD><TD>X<TD>X<TD>X<TR><TD>1255<TD>Hebrew<TD>X<TD><TD><TD><TD>X<TR><TD>1256<TD>Arabic<TD>X<TD><TD><TD><TD>X<TR><TD>1257<TD>Baltic<TD>X<TD><TD><TD><TD>X<TR><TD>1361<TD>Korean (Johab)<TD>X<TD><TD><TD>**<TD>X<TBODY><TR><TD>437<TD>MS-DOS United States<TD><TD>X<TD>X<TD>X<TD>X<TR><TD>708<TD>Arabic (ASMO 708)<TD><TD>X<TD><TD><TD>X<TR><TD>709<TD>Arabic (ASMO 449+, BCON V4)<TD><TD>X<TD><TD><TD>X<TR><TD>710<TD>Arabic (Transparent Arabic)<TD><TD>X<TD><TD><TD>X<TR><TD>720<TD>Arabic (Transparent ASMO)<TD><TD>X<TD><TD><TD>X</TABLE>

would be rendered something like this:

                  CODE-PAGE SUPPORT IN MICROSOFT WINDOWS===============================================================================Code-Page | Name                         | ACP  OEMCP | Windows Windows Windows    ID    |                              |            |  NT 3.1 NT 3.51    95-------------------------------------------------------------------------------   1200   | Unicode (BMP of ISO 10646)   |            |    X       X       *   1250   | Windows 3.1 Eastern European |  X         |    X       X       X   1251   | Windows 3.1 Cyrillic         |  X         |    X       X       X   1252   | Windows 3.1 US (ANSI)        |  X         |    X       X       X   1253   | Windows 3.1 Greek            |  X         |    X       X       X   1254   | Windows 3.1 Turkish          |  X         |    X       X       X   1255   | Hebrew                       |  X         |                    X   1256   | Arabic                       |  X         |                    X   1257   | Baltic                       |  X         |                    X   1361   | Korean (Johab)               |  X         |            **      X-------------------------------------------------------------------------------    437   | MS-DOS United States         |        X   |    X       X       X    708   | Arabic (ASMO 708)            |        X   |                    X    709   | Arabic (ASMO 449+, BCON V4)  |        X   |                    X    710   | Arabic (Transparent Arabic)  |        X   |                    X    720   | Arabic (Transparent ASMO)    |        X   |                    X===============================================================================

A graphical user agent might render this as:

A table with grouped rows and columns

This example illustrates howCOLGROUP can be used to group columnsand set the default column alignment. Similarly,TBODY isused to group rows. Theframe andrules attributes tell the user agentwhich borders and rules to render.


previous  next contents  elements  attributes  index

[8]ページ先頭

©2009-2025 Movatter.jp