ptg16476052
254 LESSON 10: Building Tables
You can change the width of the border around the table by changing the number value
in the border attribute. Figure 10.7 shows a table that has a border width of 10 pixels.
The table and border definition looks like this :
Input ▼
<table border="10" style="width:100%;">
Output ▼
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:
<table style="border: 1px solid red;">
<!-- Table rows and cells go here. -->
</table>
To draw borders around all the cells in a table (the way the border attribute does), the
easiest way is to use a style sheet like this:
<style>
table { border: 1px solid black; }
FIGURE 10.7
A table with the
border width set to
10 pixels.
You really should avoid using tables for layout. Even if you use
the previously mentioned indicators, they are still difficult for
screen readers and other assistive devices to read. This book
provides information on how to use CSS for layout in Lesson 15,
“Advanced CSS: Page Layout with CSS.”
NOTE