<table>
tag. Of course, you
end your tables with the </table>
tag. If you want the table
to have a border, use a border
attribute to specify the width of
the border in pixels. A border size of 0
or none
(or
leaving the border
attribute out entirely) will make the border
invisible, which is handy if you find yourself using a table as a page layout
tool (not recommended).The
<tr>
tag creates a table row, which contains one or more
cells of information before the closing </tr>
. To create
these individual cells, use the <td>
tag
(<td>
stands for table data). Place the table information
between the <td>
and </td>
tags. A
cell is a rectangular region that can contain any text, images, and
HTML tags. Each row in a table consists of at least one cell. Multiple cells
within a row form columns in a table.There is one more basic tag involved in building tables. The
<th>
tag works exactly like a <td>
tag
except <th>
indicates that the cell is part of the heading of
the table. Most web browsers render the text in <th>
cells as
centered and boldface.To boldface the words
hello
and there
, change the
table code to this:
<table
style="font-weight:bold">
<tr>
<td style="font-style:italic">hello</td>
<td>there</td>
</tr>
</table>
<tr>
<td style="font-style:italic">hello</td>
<td>there</td>
</tr>
</table>
Controlling Table Sizes
<table
style="width:100%">
<tr>
<td style="width:20%">skinny cell</td>
<td style="width:80%">fat cell</td>
</tr>
</table>
<tr>
<td style="width:20%">skinny cell</td>
<td style="width:80%">fat cell</td>
</tr>
</table>
The table is sized to 100%, which ensures the table fills the entire width of
the browser window. The two cells within the table are automatically resized to 20% and 80% of the
total table width, respectively.
<td><img src="losangeles.gif" alt="Los Angeles Dodgers"
/></td>
The example above shows how to place an image.
Alignment and Spanning Within Tables
You can align the contents of table cells both horizontally and vertically with
the
text-align
and vertical-align
style properties. You can apply these alignment attributes to any <tr>
,
<td>
, or <th>
tag. Alignment attributes
assigned to a <tr>
tag apply to all cells in that row.
Depending on the size of your table, you can save yourself a considerable amount
of time and effort by applying these attributes at the <tr>
level and not in each <td>
or <th>
tag.
Following are some of the more commonly used
Spanning is the process of forcing a cell to stretch across more than one row or column of a table. The
Summary of Tags and Attributes Used
vertical-align
style property values: top
, middle
,
bottom
, text-top
, text-bottom
, and
baseline
(for text). These property values give you plenty of
flexibility in aligning table data vertically.Spanning is the process of forcing a cell to stretch across more than one row or column of a table. The
colspan
attribute causes a
cell to span across multiple columns; rowspan
has the same effect
on rows. Additionally, text styles are used in the second cell within the Description
column to create bold text that is both vertically aligned to the middle and
horizontally aligned to the center of the cell.Summary of Tags and Attributes Used
Walang komento:
Mag-post ng isang Komento