User:Rewood/Making Tables in HTML

From WolfTech
Jump to navigation Jump to search

Tables are designed to allow you to store information in rows and columns. Given the different levels of support for style sheets, they are still very useful for controlling the layout of a page.

Tables are created row by row and made up of cells. The table is started with a tag and ended with a tag. Between these tags the following tags (shown in a table).

  • Tags Function
  • Table Rows
  • Table Headers

Table Data

The Table Headers are centered and bold. No align tag or strong tag was needed.

Tables can have as many columns or rows as determined by the max number of tags with in a row or tags within the table.

TIP

Keep rows separated by blank lines to make it easier to trouble shoot problems.

Sample Code:

Header for column #1  
Header for column #2  
Column 1 Data  
Column 2 Data  

TIP

Text not contained within a cell will be displayed outside of (before) the table in Netscape and Mozilla.

Data NOTE

The above sample table does not display the borders (grid lines),

Tag Attributes Function

  • TABLE BORDER Defines the weight of the border around the cells. Syntax: (where n is a number representing the chosen line weight)
  • CELLSPACING Defines spacing between cells. Syntax: (where n is a number representing the number of pixels between cells)
  • CELLPADDING Defines spacing within cells (between text and cell border). Syntax: (where n is a number representing the number of pixels between cells)
  • WIDTH Defines width of table. Syntax: (where n is a number representing the width of table in pixels or percent of the window's width). To indicate percentage use "%" after n.
  • BGCOLOR Defines the background color of the table. Syntax: (where color can be a recognized color or a hex triplet color code)
  • TR ALIGN Defines the text's horizontal alignment within the table row. Syntax: (where value is one of the following)
  • LEFT - Aligned with theleft edge of the row's cells.
  • RIGHT -Aligned with the right edge of the row's cells.
  • CENTER - Centers text within the row's cells.
  • VALIGN Defines the text's vertical alignment within the row's cells. Syntax:

(where value is one of the following) TOP - Aligned with the top of the row's cells.

  • MIDDLE - Aligned with the middle of the row's cells.
  • BOTTOM - Aligned with the bottom of the row's cells. BGCOLOR Defines the background color of the row (overrides the table BGCOLOR).