HyperText Markup Language/Tag List/table

From Wikibooks, open books for an open world
Jump to navigation Jump to search

Use[edit | edit source]

The table tag is for creating a table in the HTML code. It is a simple way of organising a large amount of data. With the attributes the user can manipulate the table to create a table that suits the webpage.

Example[edit | edit source]

This is an example of the layout coding for a basic table:

<table border="1" align="center">
  <tr>
    <th>Hundredths</th> <th>Tenths</th> <th>Ones</th>
  </tr>
  <tr>
    <td>Seven</td><td>Eight</td><td>Three</td>
  </tr>
</table>

This is what the table looks like on the webpage:

Hundredths Tenths Ones
Seven Eight Three

Required attributes[edit | edit source]

border[edit | edit source]

This attribute sets the border to a value. The default value is Zero "0".

align[edit | edit source]

This attribute aligns the table. The user has three choices: center, left or right.

width[edit | edit source]

This one tells the coding how wide the table is. It can be either in pixels or in a percentage, according to the screen

Optional attributes[edit | edit source]

cellpadding[edit | edit source]

This sets the space around a cell. It has to be set to a value of 0 to 5. Default is 0.

cellspacing[edit | edit source]

This attribute is the space between cells. This attribute makes the border around them larger. It has to be set to a value of 0 to 5. Default is 0.

spacing[edit | edit source]

This attribute basically tells the user what the intentions to the table are. It is not seen on the webpage. It is is comment.

Standard attributes[edit | edit source]

More info[edit | edit source]

http://www.yourhtmlsource.com/tables/basictables.html Tables on yourhtmlsource