The TABLE element in HTML 3.2 may have an ALIGN attribute. It specifies the horizontal alignment of the entire table (as opposite to ALIGN attributes in TR, TD, and TH elements which affect the alignments of table cell contents). Its value is one of LEFT, CENTER, RIGHT, and the default is left alignment.
In particular, assuming a TABLE element with ALIGN=RIGHT (or ALIGN=LEFT), should the table be presented on the right so that normal text floats on the left (or on the right) of the table? Schematically speaking, should
<TABLE ALIGN=RIGHT> <TR> <TD> tablestuff </TD></TR> </TABLE> normal textbe presented as
normal text tablestuffor as
tablestuff normal textor perhaps in some other way? In practice, most browsers seem to use the first interpretation. (Notice that in this interpretation, there are alternatives: should the text which appears in the HTML file before the TABLE float around it, or should the text after it do so, or should both of them do so? Could this even vary within a browser, not just between browsers?)
The HTML 3.2 specification says only the things mentioned above about the issue; to quote it, is says as follows:
whereas RFC 1942 says more:
- align
- This takes one of the case insensitive values: LEFT, CENTER or RIGHT. It specifies the horizontal placement of the table relative to the current left and right margins. It defaults to left alignment - -
Since only the use of an BR element after a TABLE element is discussed, the intention seems to be that only text following a TABLE element may flow around it.
- ALIGN
- Defines the horizontal position of the table relative to the current left and right margins. ALIGN=CENTER centers the table midway between the left and right margins. To allow text to flow around the table, use ALIGN=LEFT to position the table at the left margin, with text flowing around its right handside, or use ALIGN=RIGHT to position the table at the right margin, with text flowing around its left handside.
Note you can use <BR CLEAR=LEFT> after the table element if you want to avoid text flowing along side the table when you have specified ALIGN=LEFT, or <BR CLEAR=RIGHT> for a right aligned table. Greater control over textflow is possible using style sheets.
The HTML 3.2 specification also says that HTML 3.2 includes a subset of RFC 1942, but this shouldn't be taken too normatively. And after all, leaving some presentation issue unspecified (browser-dependent) belongs to what can be called subsetting.
But HTML 3.2 tables being based on the model in RFC 1942, it seems that the wording in HTML 3.2 is to be interpreted as a deliberate omission of the more exact specification in RFC 1942.
Thus, I conclude that an HTML 3.2 compliant browser is neither required to nor prohibited from flowing regular text around a table with ALIGN=RIGHT (or ALIGN=LEFT). However, despite the vagueness of the description of the BR element, it seems that a suitable BR with CLEAR attribute should prohibit such flowing.
In any case, you should try to make text appear alongside with a table (or an image), either by floating or some other method such as nested tables, only if there is a logical connection between the text and the table (or the image).
The specifications seem to be quite silent about such situations, since the word "text" can hardly be interpreted as applying to a table.
In fact, popular browsers differ in their treatment of such situations: Netscape shows the tables side by side, whereas Internet Explorer displays then first one left aligned, then below that the second one right aligned. A more reliable (and more logical) way of achieving such presentation is to use nested tables.
Jukka Korpela,
jkorpela@malibutelecom.com
This document belongs to the context of
Learning HTML 3.2 by Examples
The URL for this document is
../HTML3.2/tablealign.html
Created: October 27, 1997