📄 rfc1942.txt
字号:
Fixed Layout Algorithm For this algorithm, it is assumed that the number of columns is known. The column widths by default should be set to the same size. Authors may override this by specifying relative or absolute column widths, using the COLGROUP or COL elements. The default table width is the space between the current left and right margins, but may be overridden by the WIDTH attribute on the TABLE element, or determined from absolute column widths. To deal with mixtures of absolute and relative column widths, the first step is to allocate space from the table width to columns with absolute widths. After this, the space remaining is divided up between the columns with relative widths. The table syntax alone is insufficient to guarantee the consistency of attribute values. For instance, the number of columns specified by the COLS attribute may be inconsistent with the number of columns implied by the COL elements. This in turn, may be inconsistent with the number of columns implied by the table cells. A further problem occurs when the columns are too narrow to avoid overflow of cell contents. The width of the table as specified by the TABLE element or COL elements may result in overflow of cell contents. It isRaggett Experimental [Page 23]RFC 1942 HTML Tables May 1996 recommended that user agents attempt to recover gracefully from these situations, e.g. by hyphenating words and resorting to splitting words if hyphenation points are unknown. In the event that an indivisible element causes cell overflow, the user agent may consider adjusting column widths and re-rendering the table. In the worst case clipping may be considered if column width adjustments and/or scrollable cell content are not feasible. In any case if cell content is split or clipped this should be indicated to the user in an appropriate manner.Autolayout Algorithm If the COLS attribute is missing from the table start tag, then the user agent should use the following autolayout algorithm. It uses two passes through the table data and scales linearly with the size of the table. In the first pass, line wrapping is disabled, and the user agent keeps track of the minimum and maximum width of each cell. The maximum width is given by the widest line. As line wrap has been disabled, paragraphs are treated as long lines unless broken by <BR> elements. The minimum width is given by the widest word or image etc. taking into account leading indents and list bullets etc. In other words, if you were to format the cell's content in a window of its own, determine the minimum width you could make the window before the cell begins to overflow. Allowing user agents to split words will minimize the need for horizontal scrolling or in the worst case clipping of cell contents. This process also applies to any nested tables occuring in cell content. The minimum and maximum widths for cells in nested tables are used to determine the minimum and maximum widths for these tables and hence for the parent table cell itself. The algorithm is linear with aggregate cell content, and broadly speaking independent of the depth of nesting. To cope with character alignment of cell contents, the algorithm keeps three running min/max totals for each column: Left of align char, right of align char and un-aligned. The minimum width for a column is then: max(min_left + min_right, min_non-aligned). The minimum and maximum cell widths are then used to determine the corresponding minimum and maximum widths for the columns. These in turn, are used to find the minimum and maximum width for the table. Note that cells can contain nested tables, but this doesn't complicate the code significantly. The next step is to assign column widths according to the available space (i.e. the space between theRaggett Experimental [Page 24]RFC 1942 HTML Tables May 1996 current left and right margins). For cells which span multiple columns, a simple approach, as used by Arena, is to evenly apportion the min/max widths to each of the constituent columns. A slightly more complex approach is to use the min/max widths of unspanned cells to weight how spanned widths are apportioned. Experimental study suggests a blend of the two approaches will give good results for a wide range of tables. The table borders and intercell margins need to be included in assigning column widths. There are three cases: 1. The minimum table width is equal to or wider than the available space. In this case, assign the minimum widths and allow the user to scroll horizontally. For conversion to braille, it will be necessary to replace the cells by references to notes containing their full content. By convention these appear before the table. 2. The maximum table width fits within the available space. In this case, set the columns to their maximum widths. 3. The maximum width of the table is greater than the available space, but the minimum table width is smaller. In this case, find the difference between the available space and the minimum table width, lets call it W. Lets also call D the difference between maximum and minimum width of the table. For each column, let d be the difference between maximum and minimum width of that column. Now set the column's width to the minimum width plus d times W over D. This makes columns with large differences between minimum and maximum widths wider than columns with smaller differences. This assignment step is then repeated for nested tables using the minimum and maximum widths derived for all such tables in the first pass. In this case, the width of the parent (i.e. enclosing) table cell plays the role of the current window size in the above description. This process is repeated recursively for all nested tables. The topmost table is then rendered using the assigned widths. Nested tables are subsequently rendered as part of the parent table's cell contents. If the table width is specified with the WIDTH attribute, the user agent attempts to set column widths to match. The WIDTH attribute is not binding if this results in columns having less than their minimum (i.e. indivisible) widths.Raggett Experimental [Page 25]RFC 1942 HTML Tables May 1996 If relative widths are specified with the COL element, the algorithm is modified to increase column widths over the minimum width to meet the relative width constraints. The COL elements should be taken as hints only, so columns shouldn't be set to less than their minimum width. Similarly, columns shouldn't be made so wide that the table stretches well beyond the extent of the window. If a COL element specifies a relative width of zero, the column should always be set to its minimum width.HTML Table DTD The DTD or document type definition provides the formal definition of the allowed syntax for HTML tables.<!-- Content model entities imported from parent DTD: %body.content; allows table cells to contain headers, paras, lists, form elements and even arbitrarily nested tables. %text; is text characters, including character entities and character emphasis elements, IMG and anchors--><!ENTITY % attrs "id ID #IMPLIED -- element identifier -- class NAMES #IMPLIED -- for subclassing elements -- lang NAME #IMPLIED -- as per RFC 1766 -- dir (ltr|rtl) #IMPLIED -- I18N text direction --"><!-- The BORDER attribute sets the thickness of the frame around the table. The default units are screen pixels. The FRAME attribute specifies which parts of the frame around the table should be rendered. The values are not the same as CALS to avoid a name clash with the VALIGN attribute. The value "border" is included for backwards compatibility with <TABLE BORDER> which yields frame=border and border=implied For <TABLE BORDER=1> you get border=1 and frame=implied. In this case, its appropriate to treat this as frame=border for backwards compatibility with deployed browsers.--><!ENTITY % Frame "(void|above|below|hsides|lhs|rhs|vsides|box|border)">Raggett Experimental [Page 26]RFC 1942 HTML Tables May 1996<!-- The RULES attribute defines which rules to draw between cells: If RULES is absent then assume: "none" if BORDER is absent or BORDER=0 otherwise "all"--><!ENTITY % Rules "(none | groups | rows | cols | all)"><!-- horizontal placement of table relative to window --><!ENTITY % Where "(left|center|right)"><!-- horizontal alignment attributes for cell contents --><!ENTITY % cell.halign "align (left|center|right|justify|char) #IMPLIED char CDATA #IMPLIED -- alignment char, e.g. char=':' -- charoff CDATA #IMPLIED -- offset for alignment char --" ><!-- vertical alignment attributes for cell contents --><!ENTITY % cell.valign "valign (top|middle|bottom|baseline) #IMPLIED" ><!ELEMENT table - - (caption?, (col*|colgroup*), thead?, tfoot?, t body+)><!ELEMENT caption - - (%text;)+><!ELEMENT thead - O (tr+)><!ELEMENT tfoot - O (tr+)><!ELEMENT tbody O O (tr+)><!ELEMENT colgroup - O (col*)><!ELEMENT col - O EMPTY><!ELEMENT tr - O (th|td)+><!ELEMENT (th|td) - O %body.content><!ATTLIST table -- table element -- %attrs; -- id, lang, dir and class -- align %Where; #IMPLIED -- table position relative to -- -- window -- width CDATA #IMPLIED -- table width relative to window -- cols NUMBER #IMPLIED -- used for immediate display mode -- border CDATA #IMPLIED -- controls frame width around -- -- table -- frame %Frame; #IMPLIED -- which parts of table frame to -- -- include -- rules %Rules; #IMPLIED -- rulings between rows and cols -- cellspacing CDATA #IMPLIED -- spacing between cells -- cellpadding CDATA #IMPLIED -- spacing within cells --Raggett Experimental [Page 27]RFC 1942 HTML Tables May 1996 ><!-- ALIGN is used here for compatibility with deployed browsers --><!ENTITY % Caption "(top|bottom|left|right)"><!ATTLIST caption -- table caption -- %attrs; -- id, lang, dir and class -- align %Caption; #IMPLIED -- relative to table -- ><!--COLGROUP groups a set of COL elements. It allows you to groupseveral columns together.--><!ATTLIST colgroup %attrs; -- id, lang, dir and class -- span NUMBER 1 -- default number of columns in -- -- group -- width CDATA #IMPLIED -- default width for enclosed COLs -- %cell.halign; -- horizontal alignment in cells -- %cell.valign; -- vertical alignment in cells -- ><!-- COL elements define the alignment properties for cells in a given column or spanned columns. The WIDTH attribute specifies the width of the columns, e.g. width=64 width in screen pixels width=0.5* relative width of 0.5--><!ATTLIST col -- column groups and properties -- %attrs; -- id, lang, dir and class -- span NUMBER 1 -- number of columns spanned by -- -- group -- width CDATA #IMPLIED -- column width specification -- %cell.halign; -- horizontal alignment in cells -- %cell.valign; -- vertical alignment in cells -- ><!-- Use THEAD to duplicate headers when breaking table across page boundaries, or for static headers when body sections are rendered in scrolling panel. Use TFOOT to duplicate footers when breaking table across page boundaries, or for static footers whenRaggett Experimental [Page 28]RFC 1942 HTML Tables May 1996 body sections are rendered in scrolling panel. Use multiple TBODY sections when rules are needed between groups of table rows.--><!ATTLIS
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -