Sunday, December 28, 2008

Table Frames And Rules

<table
frame="frame value"
rules="rules value">
...</table>
 
Which table border sides to draw
Which inner-table rules to draw
 


In conjunction with borderattribute, you can also specify exactly how to display the frame around your table and the border lines or 'rules' dividing rows and columns.

These are detailed below:

  • frame="frame value" ~ Although not widely used, the frameattribute is officially part of the HTML 4.01 Specification and serves to define exactly how to display the border or 'frame' surrounding your table. To do this, place the frame="frame value" attribute-value pair in your <table> tag where frame value equals one of the following and will display the table sides defined in the respective definition:
    voidNo frame is drawn (default value).
    aboveOnly the top side is drawn.
    belowOnly the bottom side is drawn.
    hsidesOnly the top and bottom sides are drawn.
    vsidesOnly the left and right sides are drawn.
    lhsOnly the left-hand side is drawn.
    rhsOnly the right-hand side is drawn.
    boxAll four sides are drawn.
    borderAll four sides are drawn.
  • rules="rules value"~ Also not widely used (largely because web authors seldom use tables astables), the rules attribute will define which lines or rulesto draw between rows and columns in your table. To do this, place the rules="rules value" attribute-value pair in your <table> tag where rules valueequals one of the following and will display the rules defined in the respective definition:
    noneNo rules are drawn (default value).
    groupsRules drawn between row groups and column groups.
    rowsRules are drawn between rows only.
    colsRules are drawn between columns only.
    allRules are drawn between all rows and columns.

Note that the table frame and rules can be drawn in the absence of the borderattribute. However if the border attribute is expressed and has a value of "0", it will override any values entered for frame or rules(frame will default to void while rules will default to none).


Example 1 - SOURCE CODE

<table border="4" bordercolor="#808080"
frame="hsides" rules="rows">
   <tr><td>Cell content...</td><td>Cell content...</td></tr>
   <tr><td>Cell content...</td><td>Cell content...</td></tr>
   <tr><td>Cell content...</td><td>Cell content...</td></tr>
</table>



Example 1 - RESULT
Cell content...Cell content...
Cell content...Cell content...
Cell content...Cell content...

No comments:

Post a Comment