HTML and CSS Reference
In-Depth Information
FIGURE 10.17
Table cell colors.
DO test your tables with various sizes
of browser windows to make sure they
look okay.
DO increase the cellpadding in your
tables to make them more readable.
DON'T use tables just to put borders
around elements on a page; use CSS.
DON'T use tables just to apply a back-
ground color to an element; use CSS
DON'T use tables format nontabular
data if you can help it.
Aligning Your Table Content
Another enhancement that you can make to your tables is to adjust the alignment of their
content. The align attribute aligns content horizontally, whereas the valign attribute
aligns content vertically, and of course, you can use CSS properties to accomplish the
same things, too. The following sections describe how to use these attributes in tables.
Table Alignment
By default, tables are displayed on a line by themselves along the left side of the page,
with any text above or below the table. However, you can use the align attribute to align
tables along the left or right margins and wrap text alongside them the same way you can
with images.
align=“left” aligns the table along the left margin, and all text following that table is
wrapped in the space between that table and the right side of the page. align=“right”
does the same thing, with the table aligned to the right side of the page.
In the example shown in Figure 10.18, a table that spans 70% of the width of the page is
aligned to the left with the following code:
<table border=“1” align=“left” width=“70%”>
Search WWH ::

Custom Search