HTML and CSS Reference
In-Depth Information
.
Output
FIGURE 10.6
A table set to
100% width.
CAUTION
If you make your table too narrow for whatever you put in it, the
browser will ignore your settings and makes the table as wide as
it needs to be to display the content, unless you use the CSS
overflow property to specify otherwise. The overflow property was
discussed in Lesson 8, “Using CSS to Style a Site.”
It's nearly always a better idea to specify your table widths as percentages rather than as
specific pixel widths. Because you don't know how wide the browser window will be,
using percentages allows your table to be reformatted to whatever width the browser is.
Using specific pixel widths might cause your table to run off the page. Also, if you make
your tables too wide using a pixel width, your pages might not print properly.
NOTE
Specifying column widths in percentages is illegal under the
XHTML 1.0 Strict specification. If you want to specify your column
widths in that manner, use Transitional DTD or specify the widths
in a style sheet. I discuss using style sheets in this manner fur-
ther along in this lesson.
Changing Table Borders
The border attribute, which appears immediately inside the opening <table> tag, is the
most common attribute of the <table> element. With it, you specify whether border lines
are displayed around the table and if so, how wide the borders should be.
The border attribute has undergone some changes since it first appeared in HTML:
In HTML 2.0, you used <table border> to draw a border around the table. The
border could be rendered as fancy in a graphical browser or just a series of dashes
and pipes ( | ) in a text-based browser.
n
 
 
 
Search WWH ::




Custom Search