Collected by
Elizabeth Janson

Home Page

FRAME and RULE

  A style-sheet reminder on inheritance. Netscape does not automatically carry BODY style into tables, so include TR and TD when BODY is defined - eg
<STYLE>
BODY, TR, TD {font-family:verdana; color:blue}
</STYLE>

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.

Attribute for Borders

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

Attribute definitions

frame = void|above|below|hsides|lhs|rhs|vsides|box|border
This attribute specifies which sides of the frame surrounding a table will be 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
This attribute specifies which rules will appear between cells within a table. 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 (see THEAD, TFOOT, and TBODY) and column groups (see COLGROUP and COL) only.
  • rows: Rules will appear between rows only.
  • cols: Rules will appear between columns only.
  • all: Rules will appear between all rows and columns.

To help distinguish the cells of a table, we can set the border attribute of the TABLE element.


border = pixels
This attributes specifies the width (in pixels only) of the frame around a table.

In this example, the user agent should show borders five pixels thick on the left-hand and right-hand sides of the table, with rules drawn between each column.

<TABLE border="5" bordercolor=red frame="vsides" rules="cols">
<TR> <TD>1 rule <TD>2 <TD>3
<TR> <TD>4 <TD>5 rule <TD>6
<TR> <TD>7 <TD>8 <TD>9 rule
</TABLE>
Again, close the tags for Netscape
1 rule 2 3
4 5 rule 6
7 8 9 rule


The following settings should be observed by user agents for backwards compatibility.
See the next page for more on frames and rules

  • Setting border="0" implies frame="void" and, unless otherwise specified, rules="none".
  • Other values of border imply frame="border" and, unless otherwise specified, rules="all".
  • The value "border" in the start tag of the TABLE element should be interpreted as the value of the frame attribute. It implies rules="all" and some default (non-zero) value for the border attribute.

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. The border attribute also defines the border behavior for the OBJECT and IMG elements, but takes different values for those elements.


Email
CSS begins here
Back to border-collapse or on to a practical table.

This page is part of Elizabeth Janson's web site

http://www.oocities.org/elizatk/index.html

My other sites are the Anglican Parish of Northern Mallee,
Tetbury residents in the Eighteenth Century
my Australian Family History and Barrie, our Family Poet.