How to Declare Table Backgrounds in HTML
Table background can be specified using one of the following two ways:
1. bgcolor attribute: You can set background color for whole table or just for one cell.
2. background attribute: You can set background image for whole table or just for one cell.
The tag <bordercolor> and <bgcolor> is introduced.
Example
<!DOCTYPE html>
<html>
<head>
<title>Scholars Table Background</title>
</head>
<body>
<table border="1" bordercolor="green" bgcolor="yellow">
<tr>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
</tr>
<tr><td rowspan="2">Row 1 Cell 1</td><td>Row 1 Cell 2</td><td>Row 1 Cell 3</td></tr>
<tr><td>Row 2 Cell 2</td><td>Row 2 Cell 3</td></tr>
<tr><td colspan="3">Row 3 Cell 1</td></tr>
</table>
</body>
</html>
Result:
You can try this using Dreamweaver or Frontpage Editors. For Notepad, be sure to save as .html to view in browser.
Example
<!DOCTYPE html>
<html>
<head>
<title>Scholars Table Background</title>
</head>
<body>
<table border="1" bordercolor="green" bgcolor="yellow">
<tr>
<th>Column 1</th>
<th>Column 2</th>
<th>Column 3</th>
</tr>
<tr><td rowspan="2">Row 1 Cell 1</td><td>Row 1 Cell 2</td><td>Row 1 Cell 3</td></tr>
<tr><td>Row 2 Cell 2</td><td>Row 2 Cell 3</td></tr>
<tr><td colspan="3">Row 3 Cell 1</td></tr>
</table>
</body>
</html>
Result:
You can try this using Dreamweaver or Frontpage Editors. For Notepad, be sure to save as .html to view in browser.
No comments:
Post a comment