There are three ways to increase the space between columns in a table written in the HTML programming language that is the basis of the Web. You can use the table's "cellspacing" attribute to increase the space between all the cells in the table; you can use the "cellpadding" attribute to add padding inside all the cells; or you can use an individual cell's "width" attribute to widen it.
Instructions
- 1
Find the opening tag. In HTML, table data is always preceded by a
tag and followed by a closing1 | 2 |
3 | 4 |
This creates a table with a one-pixel border around it, containing two rows (the two ... sections) of two columns each (the four ...) sections. The cells contain the numbers 1 to 4. You can test this, along with any other HTML code, by copy and pasting it into the HTML Test Bed (see Resources) and clicking "Display."
2Add a "cellspacing" or "cellpadding" attribute to the
tag. "Cellspacing" adds empty space to the table between each cell; "cellpadding" expands each cell to contain empty space around its contents. For example, if the tag previously read:change it to:
or
where X is the size of the added space, in pixels. You can also combine spacing and padding -- just put them both in there, with a space separating them, just as a space separates the added attributes above from the "border" attribute.
3Change the width of an individual cell in the table -- adding space between it and the columns around it but nowhere else in the table -- by adding an attribute to that cell's tag. This will be a
where "XYZ" is the contents of the cell. Add a "width" attribute to the
or as a percentage of the browser window:
In the second example, the width of the cell is always exactly 20% of the width of the browser window, no matter what the user's screen resolution is or how he's sized his window. This is often a more reliable and compatible way of expressing width -- it ensures that the table won't become unreadable under certain conditions. Whichever way you do it, you can set the width of as many cells as you want. Add a "width" attribute to the
tag like this: | XYZ | tag. The width can be expressed either as pixels: | XYZ | XYZ | tag of every cell in a column to effectively expand that column.
Copyright © 2011 Best Drop Leaf Table Tips All Right Reserved.
Powered by Blogger Blogger Theme by IdBlogDesign |
0 comments:
Post a Comment