The row is one of the two basic parts of a table
, which is, on the one hand, the main structural elements of HTML based web pages
, and, on the other, the main building unit of databases. Together with the columns
, they allow for the contents of a table to be organized in an easy to understand and use way.
Table of contents :
Rows in HTML tables
In the context of HTML pages, the row represents the horizontal line of cells holding the information input in a table. Each cell within a row may contain various type of information like text, paragraphs, images, lists, links, forms, etc. So, this means that you can place different page contents elements within a single table row.
Within the HTML code the table row is marked with a <TR> tag where TR stands for a 'Table Row'. To set apart a group of table cells in a row you need to just begin it with <TR>, no end tag </TR> is necessary. The table cells, containing the actual data of the table, are marked with the <TD> tag. The example below demonstrates how the block of code for a 3-row table should look like.
Example of a table containing three rows, each begun by the <TR> tag:
summary="This table charts the number of
cups of coffee consumed by each senator,
the type of coffee (decaf or regular),
and whether taken with sugar.">
<CAPTION>Cups of coffee consumed by each senator</CAPTION>
<TH id="header3" abbr="Type">Type of Coffee</TH>
<TD headers="header1">M. Drun</TD>
<TD headers="header1">K. Jazzy</TD>
<TD headers="header1">V. Floppy</TD>
Example of how the same 3-row table will appear in a browser:
Cups of coffee consumed by each senator
The table rows may define certain style properties for the contained data cells. This is done with the help of special style attributes to the
ALIGN attribute - defines the horizontal alignment of cells within a row. There are a few possible alignment positions defined by this attribute - left (the cell contents are aligned to the left side of the cell), center (the cell data is positioned at the center of the cell), right (the data is aligned to the cell's right side), justify (the data contents are aligned bilaterally), char (the cell contents are aligned to the character defined by the CHAR attribute).
VALIGN attribute - a style attribute defining the vertical alignment of cells within a row. Using this attribute you can define several different positions for the contents of row cells - top (the cell data are placed at the top of the cell), middle (the cell contents are centered vertically), bottom (the date is located at the cell's bottom) and baseline (the first line of all cells in a column are equally aligned).
BGCOLOR attribute - a style attribute specifying the background color of row cells. This attribute is considered deprecated due to its inflexibilities and incompatibity with some browsers. For that reason, you will be recommended to use stylesheets for specifying a row's background color instead of this row attribute.
Rows in databases
Since tables have another important application - to store and organize the information in
, we can talk about database table
rows as well. In the context of databases, a row represents a single line of data cells in a table, while columns refer to the vertical lines of data cells in the same table.
All rows within a table are characterized by the one and the same structure and you can have as many of them as you need. Each row by rule contains related content i.e. the cells in a row represent information related to one and the same object, where each cell contains a data value of a particular type as defined by the table column. For example, let's say a table keeps record of the online payments made by customers on an e-store. Each customer will have one row assigned in this table, where the first data cell will spedify a unique identifier (that identfies the customer on record), the second will include the name of the buyer, the third - the amount of money paid by him for the service, the fourth - the payment currency, etc.
Example of a database row: