Share this Page URL

Chapter 10. Table Talk: Adding Tables to... > Table Refinishing—More Table Tidbits - Pg. 114

Table Talk: Adding Tables to Your Page 114 A Whack of Table Attributes For our next table trick, we pull a few more table attributes out of our HTML hat. There are all kinds of wild extras, but the following are the most useful ones: · The background color.You learned in Chapter 6, "A Picture Is Worth a Thousand Clicks: Work- ing with Images," that you can adjust the background color of your entire web page. However, you can also assign a custom color to just the background of a table or even an individual cell. To do this, you add the BGCOLOR="# rrggbb " attribute to the <TABLE> tag or the <TD> tag, where rrggbb is a value that specifies the color you want (see Chapter 3). For example, the following tag gives your table a light gray background: <TABLE BGCOLOR="#CCCCCC"> · A background image.Another thing you can do is set a background image instead of just a background color for a table or cell. This is just like setting a background image for a web page. In this case, you toss the BACKGROUND attribute inside the <TABLE> or <TD> tag and set the attribute equal to the name of the image file you want to use, as in this example: <TABLE BACKGROUND="tablebg.gif"> · The border size.To change the thickness of the table border, you can assign a value to the <TABLE> tag's BORDER attribute. (Note that this applies only to the part of the border that surrounds the outside of the table; the inner borders aren't affected.) For example, to display your table with a border that's five units thick, you use the following: <TABLE BORDER="5"> · The width of the table.The browser usually does a pretty good job of adjusting the width of a table to accommodate the current window size. If you need your table to be a particular width,