Dreamweaver: Inserting Tables
Tables allow you to control the relative positioning of elements on a page by creating a series of connected cells. These cells contain text and have a specific or relative size specified.
|row 1, cell 1||row 1, cell 2|
|row 2, cell 1||row 2, cell 2|
Tables are used for content that needs to be in the layout format of a table. One example of the kind of information that can be formatted as a table:
|Product 1||This is a description of features for product 1.||$10|
|Product 2||This is a description of features for product 2.||$20|
|Product 3||This is a description of features for product 3.||$30|
|Product 4||This is a description of features for product 4.||$40|
You create tables by clicking on the table icon in the object palette.
You’ll be asked to set the following attributes:
- Number of rows
- Number of columns
- Width in Percent or Pixels
- The width of the border (the beveled edge on the outer part of the table)
- The cell padding (the text margin, left, right, top, bottom)
- The cell spacing (the width of the cell walls)
Table properties are accessible by selecting the whole table.
Table cell properties
Cell properties are accessible by placing the selection point inside a cell – the cell properties will show up in the lower half of the property inspector.
The difference between percent and pixels
If the table is set to percent, the table will change size depending on how wide the user sets the browser. If the table cells are set to percent, their size varies as a percentage of the whole table.
Flowing text around tables
For flowing text around tables, tables are just like images, and have the same alignment attributes. The most commonly used settings are “left” and “right”.
The table format is controlled by the Border, Cellspacing, and Cellpadding (explained below). The settings for these table attributes are accessible in the middle right of the table property inspector. If you want the table borders to be invisible to the viewer and/or are using the table to knit together a set of images together, set all of these attributes to zero.
The setting of the table border in pixels affects the width of the border around the edge of the table.
The setting of the table cellspacing affects the width of the border around each cell
The setting of the table cellpadding affects the width of the margin. This margin is on the left, right, top and bottom
Selecting a table
There are three ways to select the whole table.
- click on the upper left hand corner of the table when you see the cursor turn into a hand (this is sometimes hard to do).
- click anywhere inside the table, then select MODIFY>TABLE>SELECT TABLE or type control-A twice
- click anywhere inside the table, the click on the <table> tag at the bottom of the document window
Adjust the rightmost cell first
If you are setting specific widths of the table, set the width of the rightmost cell first, and work your way left. This avoids the problem of the cells squeezing up against each other as happens when you adjust from left to right.
Row and Column Span
Row and Column span enable a cell to span adjacent cells. For example, if you set the row span for a cell to 2, the cell will become two rows tall. Likewise, if you set the column span for a cell to 2, it will become two columns wide. The controls for changing these cell attributes are in the lower left hand corner of the table cell properties inspector. To create a span, select the cells you want to consolidate into one cell, and click on the merge button in the inspector. To remove a span, put the cursor inside the cell to be broken apart, and click on the split button in the inspector.
|This cell has a rowspan of two.||This cell has a column span of two.|
Cell alignment — horizontal and vertical
The location of any text or graphic inside of a table cell is affected by the alignment setting for the cell. By default, the cell contents will be aligned to the left horizontally, and in the middle vertically. To change this, click inside the cell, and then set the Horz or Vert setting in the lower half of the property inspector.
The contents of a cell affects its size
Even when a cell has a specific width and height set, if the contents of the cell are bigger, the cell will always grow to accommodate the size of the content. This is true for both text and graphics. For example,. if the text in a cell doesn’t wrap (either because there are no spaces, or because you set the cell to not allow wrapping), the cell will expand its width to accommodate the text, regardless of the width setting for that cell or the whole table.
Clear row heights or column widths
When you are using a table to control the display of a series of image to be composited together, you should have no widths or heights set. This enables the image in the cell to determine the width and height of the cell. If you select the entire table, in the lower left hand of the properties inspector, there are two buttons (the first and second ones) that enable to you clear the row heights or column widths.
Convert table widths to pixels or percent
If you are having problems with a table, you may have a mix of pixels and percents, not a good thing generally. Dreamweaver has a method for setting all the table widths to the same method. Select the entire table, and in the lower left hand of the properties inspector, there are two buttons (the third and fourth ones) that enable to you set the table and all its cells to pixels or percent.