The valign attribute is used to set the vertical l alignment of cell data in a table row. The valign attribute can support four values one at a time which include top, center, bottom or baseline.
By default, the table is aligned on left side of the browser, the alignment of table can be change using the table align attribute. The table align can be set to right, left and center.
In this tutorial we will see how to change the border color of table using bordercolor attribute. We have already learnt to change the background color, now with border color you will have more options to add more colors in the table to make it looks good.
The purpose of summary attribute is to mention the description of table. The browsers not display the text of summary attribute, the information can be considered as additional information for the webmaster.
The cellpadding and cellspacing is often used togather as attributes of table container but keep in mind the purpose of both tags are different.As discussed in previous tutorial cellpadding add spaces between the cell boundaries and cell data whereas cellspacing add the white space between the table cells. The least or minimum space that you can add between the cells is zero.
In HTML, cellpadding is the attribute of Table container which is used to add space between the data and cell boundaries or corners. As we discussed in previous tutorials that each attribute has value with measurement unit in case of cellpadding the value is number and measurement unit is pixels.
The bgcolor attribute change the background color of table and it can be also used to change the color of specific row(s) and column(s) of table. The default background color of table is white and can be changed using the bgcolor attribute or CSS background-color property.
HTML code example to change the background color of table, rows and columns using the bgcolor attribute.
The width attribute is used to change the width of table, it tells the browser how much horizontal space should be covered by the table. The width attribute can support values in pixels and percentage but its a good practice to use percentage instead of pixels. Assigning values in pixels is not suggested as the computers have different resolution setting, so it may create problems.
Frame attribute in HTML tells the browser to show which side of the border. The frame attribute gives the control to modify the border style in many different way which is not possible in border attribute.
Following values can be set for frame:
Borders : Show borders on all sides of the table and between the cells
Box : Show borders on all sides of the table and between the cells
Void : Show no borders
Above : Show border on top side of the table
Below : Show border on bottom of the table
hsides : Show horizontal border on top, bottom and between the rows
vsides : Show vertical borders on right and left sides
lhs : Border on left hand side only
rhs : Border on right hand side only
In our last tutorial we have learnt how to create table without borders. In this tutorial, we will show you how to create table with border using HTML code. We will use keep enhancing the same code in our series of HTML tutorials in that way you will be able to understand the significance of new table attributes and tags
Before going further into details, it is important to understand the meaning of border. The border is the line around the table and between the cells; it’s a good practice to use it in table for more clear view of data in table cells.
The border attribute in HTML tags has default value of “1” increasing the number will make the border wider around the table but the division between the cells still remain 1 pixel.