![]() |
|
Menu
Online Stores Search This Site
Custom Search
Miscellaneous |
Path = Home : HTML Design Tips : How To Set Table Widths |
||||||||
How To Set Table Widths
The <table> tag is the HTML tag which is used to create a table on a web page. You can set the width of the table width as a value (in pixels) or as a percentage of the page width (or column width if it is inside a table itself). Seting a table width as a value<table width="400" border="1" cellpadding="5" cellspacing="0"> This code will result in a table 400 pixels wide with two columns of equal width.
Setting a table width as a percentage<table width="80%" border ="1" cellpadding="5" cellspacing="0"> This code will result in a table which has a width of 80% of the width of the page with two columns of equal width.
Note that because this table is inside the table that we use for this page it is 80% of the width of the column.
Setting a column width as a valueYou can set the widths of your columns to a fixed width. <table width="460" border ="1" cellpadding="5" cellspacing="0">
Setting a column width as a percentageYou can set the widths of your columns to a percentage of your page width. <table width="80%" border ="1" cellpadding="5" cellspacing="0">
Note that the two column widths total 100% not 80%
|
|||||||||