HTML and CSS Reference
In-Depth Information
Starting with HTML 3.2 and later, the correct usage of the border attribute was a
little different: It indicates the width of a border in pixels. <table border=“1”>
creates a 1-pixel wide border, <table border=“2”> a 2-pixel wide border, and so
on. HTML 3.2 and later browsers are expected to display the old HTML 2.0 form
of <table border> , with no value, with a 2-pixel border (as if you specified
<table border=“1”> ).
To create a border that has no width and isn't displayed, you specify <table
border=“0”> . Borderless tables are useful when you want to use the table structure
for layout purposes, but you don't necessarily want the outline of an actual table on
the page. Browsers that support HTML 3.2 and later are expected not to display a
border (the same as <table border=“0”> ) if you leave out the border attribute
You can change the width of the border drawn around the table. If border has a numeric
value, the border around the outside of the table is drawn with that pixel width. The
default is border=“1” . border=“0” suppresses the border, just as if you had omitted the
border attribute altogether.
Figure 10.7 shows a table that has a border width of 10 pixels. The table and border defi-
nition looks like this:
<table border=“10” width=“100%”>
A table with the
border width set to
10 pixels.
You can also adjust the borders around your tables using CSS, with much finer control
than the border attribute provides.
You learned about borders in Lesson 8, but there's more to them when it comes to tables.
For example, if you write a table like the one that follows, it will have a border around
the outside but no borders around the cells:
Search WWH ::

Custom Search