Saturday 28 September 2013

HTML Table Rows with Attributes

A Table is made up of Rows and Columns.  Before a Column can be defined (actually it is a cell within a Row) a row must be defined.
Rows will take their default attributes from what is defined in the <table> tag, however these attributes may be overridden when defining a table row (i.e. <tr> tag) - The following is an example of defining table row with a single row defined:
<table bgcolor="#800000" width="43%" height="70%" border="1" cellspacing="15" cellpadding="8" bordercolor="#008080" bordercolorlight="#000080" bordercolordark="#FFFFCC">
    <tr>
    </tr>

</table>
The following attributes may be defined for a Table Row:
Row Alignment
Vertical Alignment
Background Color
The values for the Row Alignment are: Left, Center, or Right.  The following is an example of defining the Table Row for each of these values:
<tr align=left>
<tr align=
center>
<tr align=
right>
The following is an example of the above table with the row alignment set to justify centered:
<table bgcolor="#800000" width="43%" height="70%" border="1" cellspacing="15" cellpadding="8" bordercolor="#008080" bordercolorlight="#000080" bordercolordark="#FFFFCC">
     <
tr align=center>
     </tr>
</table>
The vertical alignment defines where the row is to line up vertically.   Typically you would probably want the row to line up at the top, however there may be times which you want it to align vertically to create different effects. The following are examples of vertical alignment:
<tr align=center valign=top>
<tr align=center valign=
center>
<tr align=center valign=
bottom>
<tr align=center valign=
baseline>
The following is an example with the vertical alignment set to top:
<table bgcolor="#800000" width="43%" height="70%" border="1" cellspacing="15" cellpadding="8" bordercolor="#008080" bordercolorlight="#000080" bordercolordark="#FFFFCC">
     <tr align=center
valign=top>
     </tr>
</table>
Finally, you can define the background color of the Row. This following is an example  of adding in the background color for the row to be displayed in Burgundy Color:
<table bgcolor="#800000" width="43%" height="70%" border="1" cellspacing="15" cellpadding="8" bordercolor="#008080" bordercolorlight="#000080" bordercolordark="#FFFFCC">
     <tr align=center valign=top
bgcolor="#800000”>
     </tr>
</table>



No comments:

Post a Comment