Introduction to HTML tables
Tables are HTML structures that allow better control over the positioning of elements on your web pages. As an introduction. This column explains how to set the layout, cell dimensions, spacing, color, and alignment of your tables. In next month’s column, we’ll examine increasingly advanced techniques and the importance of tables in the layout of your entire website.
Table commands and structure
In FIGURE 1, I aligned the code in a specific way. While not essential, such spacing is extremely beneficial when troubleshooting your spreadsheets, as it helps you ensure commands opened and closed correctly. (Note: This code will be inserted into the BODY of your webpage.)
The first required tag is The command (TR = ‘Table Row’) represents the start of a new row (across the page). All table tags are coupled, so rows must be terminated with when completed. within a row,
Consider this with reference to Fig. 1 table dimensions Without a definition, cells automatically wrap to accommodate their contents, and tables automatically wrap to fit the cells. You can set the dimensions of both tables and individual cells using the width and height properties. For example: Or to set the dimensions of a specific cell: cell spacing and cell filling By adding the cellspacing property to the TABLE command, you can specify the spacing between the table border and the cells. In contrast, the cellpadding property inserts spaces inside the cell, ie between the contained object and the cell border. If not specified, a default value of two pixels is automatically implemented. Consequently, to have no space at all, you need to include these properties like this: Figure 2 illustrates the difference between cell spacing and cell fill. background color and background By including bgcolor and/or background properties in your TABLE command and/or your If I gave the spreadsheet a background graphic, the color of the cells (if specified) would overlay the encoded image. Note: Be careful when using these properties in conjunction with cellspacing. Netscape does not color the spaced area while Internet Explorer does. Align and validate The align property refers to the horizontal position of an element. The most common values are left, right or center (note the spelling). Valign refers to vertical alignment, associated values are top, bottom, and middle. If not specified, objects automatically inherit the property of align=”left” and valign=”center”. By using these properties in your TABLE command, you can specify the position of the entire table on the web page. When used within TD, the location of data is specified in individual cells. The following example would place the table at the top center of the page: This example would force the cell contents to the lower right corner of the cell:) The browser inserts a horizontal line, and each in this row creates a corresponding number of columns that contain data. Hence, since we can count three coupled tags, this table must have three rows. Each of these rows has three cells because they each contain three coupled cells keywords.
cell contents here
-Tags let you brighten things up. If you set the color of a specific cell, it will appear above the table color. The following example would create a blue table with an orange cell:
one Two Three
cell contents here
See more new articles in category: GUIDES