⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rfc1942.txt

📁 RFC 的详细文档!
💻 TXT
📖 第 1 页 / 共 5 页
字号:






Network Working Group                                         D. Raggett
Request for Comments: 1942                                           W3C
Category: Experimental                                          May 1996


                              HTML Tables

Status of this Memo

   This memo defines an Experimental Protocol for the Internet
   community.  This memo does not specify an Internet standard of any
   kind.  Discussion and suggestions for improvement are requested.
   Distribution of this memo is unlimited.

Abstract

   The HyperText Markup Language (HTML) is a simple markup language used
   to create hypertext documents that are portable from one platform to
   another. HTML documents are SGML documents with generic semantics
   that are appropriate for representing information from a wide range
   of applications. This specification extends HTML to support a wide
   variety of tables. The model is designed to work well with associated
   style sheets, but does not require them. It also supports rendering
   to braille, or speech, and exchange of tabular data with databases
   and spreadsheets. The HTML table model embodies certain aspects of
   the CALS table model, e.g. the ability to group table rows into
   thead, tbody and tfoot sections, plus the ability to specify cell
   alignment compactly for sets of cells according to the context.

Table of Contents

   Recent Changes  ................................................. 1
   Brief Introduction  ............................................. 2
   Design Rationale  ............................................... 5
   Walkthrough of the Table DTD  ................................... 8
   Recommended Layout Algorithms  ................................. 23
   HTML Table DTD  ................................................ 26
   References  .................................................... 29
   Security Considerations  ....................................... 30
   Author's Address  .............................................. 30

Recent Changes

   This specification extends HTML to support tables. The table model
   has grown out of early work on HTML+ and the initial draft of HTML3.
   The earlier model has been been extended in response to requests from
   information providers for improved control over the presentation of
   tabular information:



Raggett                       Experimental                      [Page 1]

RFC 1942                      HTML Tables                       May 1996


   *   alignment on designated characters such as "." and ":"
       e.g. aligning a column of numbers on the decimal point

   *   more flexibility in specifying table frames and rules

   *   incremental display for large tables as data is received

   *   the ability to support scrollable tables with fixed headers plus
       better support for breaking tables across pages for printing

   *   optional column based defaults for alignment properties

   In addition, a major goal has been to provide backwards compatibility
   with the widely deployed Netscape implementation of tables. A
   subsidiary goal has been to simplify importing tables conforming to
   the SGML CALS model. The latest draft makes the ALIGN attribute
   compatible with the latest Netscape and Microsoft browsers. Some
   clarifications have been made to the role of the DIR attribute and
   recommended behaviour when absolute and relative column widths are
   mixed.

   A new element COLGROUP has been introduced to allow sets of columns
   be grouped with different width and alignment properties specified by
   one or more COL elements. The semantics of COLGROUP have been
   clarified over previous drafts, and RULES=BASIC replaced by
   RULES=GROUPS.

   The FRAME and RULES attributes have been modified to avoid SGML name
   clashes with each other, and to avoid clashes with the ALIGN and
   VALIGN attributes. These changes were additionally motivated by the
   desire to avoid future problems if this specification is extended to
   allow FRAME and RULES attributes with other table elements.

A Brief Introduction to HTML Tables

   Tables start with an optional caption followed by one or more rows.
   Each row is formed by one or more cells, which are differentiated
   into header and data cells. Cells can be merged across rows and
   columns, and include attributes assisting rendering to speech and
   braille, or for exporting table data into databases. The model
   provides limited support for control over appearence, for example
   horizontal and vertical alignment of cell contents, border styles and
   cell margins. You can further affect this by grouping rows and
   columns together. Tables can contain a wide range of content, such as
   headers, lists, paragraphs, forms, figures, preformatted text and
   even nested tables.





Raggett                       Experimental                      [Page 2]

RFC 1942                      HTML Tables                       May 1996


Example

   <TABLE BORDER>
     <CAPTION>A test table with merged cells</CAPTION>
     <TR><TH ROWSPAN=2><TH COLSPAN=2>Average
         <TH ROWSPAN=2>other<BR>category<TH>Misc
     <TR><TH>height<TH>weight
     <TR><TH ALIGN=LEFT>males<TD>1.9<TD>0.003
     <TR><TH ALIGN=LEFT ROWSPAN=2>females<TD>1.7<TD>0.002
   </TABLE>

   On a dumb terminal, this would be rendered something like:

                 A test table with merged cells
       /--------------------------------------------------\
       |          |      Average      |  other   |  Misc  |
       |          |-------------------| category |--------|
       |          |  height |  weight |          |        |
       |-----------------------------------------|--------|
       | males    | 1.9     | 0.003   |          |        |
       |-----------------------------------------|--------|
       | females  | 1.7     | 0.002   |          |        |
       \--------------------------------------------------/




























Raggett                       Experimental                      [Page 3]

RFC 1942                      HTML Tables                       May 1996


   Next, a richer example with grouped rows and columns (adapted from
   "Developing International Software" by Nadine Kano). First here is
   what the table looks like on paper:

                     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 East. Europe   |  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
========================================================================

   The markup for this uses COLGROUP elements to group columns and to
   set default column alignment. TBODY elements are used to group rows.
   The FRAME and RULES attributes are used to select which borders to
   render.

   <table border=2 frame=hsides rules=groups>
   <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>



Raggett                       Experimental                      [Page 4]

RFC 1942                      HTML Tables                       May 1996


   <tr><td>1200<td>Unicode (BMP of ISO 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>

Design Rationale

   The HTML table model has evolved from studies of existing SGML tables
   models, the treatment of tables in common word processing packages,
   and looking at a wide range of tabular layout in magazines, books and
   other paper-based documents. The model was chosen to allow simple
   tables to be expressed simply with extra complexity only when needed.
   This makes it practical to create the markup for HTML tables with
   everyday text editors and reduces the learning curve for getting
   started. This feature has been very important to the success of HTML
   to date.

   Increasingly people are using filters from other document formats or
   direct wysiwyg editors for HTML. It is important that the HTML table
   model fits well with these routes for authoring HTML. This affects
   how the representation handles cells which span multiple rows or
   columns, and how alignment and other presentation properties are
   associated with groups of cells.

   A major consideration for the HTML table model is that the fonts and
   window sizes etc. in use with browsers are not under the author's
   control. This makes it risky to rely on column widths specified in
   terms of absolute units such as picas or pixels. Instead, tables can
   be dynamically sized to match the current window size and fonts.
   Authors can provide guidance as to the relative widths of columns,
   but user agents should to ensure that columns are wide enough to
   render the width of the largest single element of the cell's content.
   If the author's specification must be overridden, it is preferred
   that the relative widths of individual columns are not changed
   drastically.



Raggett                       Experimental                      [Page 5]

RFC 1942                      HTML Tables                       May 1996


   For large tables or slow network connections, it is desirable to be
   able to start displaying the table before all of the data has been
   received. The default window width for most user agents shows about
   80 characters, and the graphics for many HTML pages are designed with
   these defaults in mind. Authors can provide a hint to user agents to
   activate incremental display of table contents. This feature requires
   the author to specify the number of columns, and includes provision
   for control of table width and the widths of different columns in
   relative or absolute terms.

   For incremental display, the browser needs the number of columns and
   their widths. The default width of the table is the current window
   size (width="100%"). This can be altered by including a WIDTH
   attribute in the TABLE start tag. By default all columns have the
   same width, but you can specify column widths with one or more COL
   elements before the table data starts.

   The remaining issue is the number of columns. Some people have
   suggested waiting until the first row of the table has been received,
   but this could take a long time if the cells have a lot of content.
   On the whole it makes more sense, when incremental display is
   desired, to get authors to explicitly specify the number of columns

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -