HTML and CSS Reference
In-Depth Information
EXAMPLE 14.20
<html>
<head><title>Contextual Selector</title>
<style type="text/css">
1
table td { color: blue; /* Table cells will take this style */
font-size: 18pt;
font-family: verdana; }
</style>
</head>
<body bgcolor="silver">
<div align="center">
<h1><em>The Three Bears</em></h1>
<table cellspacing="20" cellpadding="20%" border="3">
<tr>
2
<td>Mama Bear</td>
</tr>
<tr>
3
<td>Papa Bear</td>
</tr>
<tr>
4
<td>Baby Bear</td>
</tr>
</table>
</div>
</body>
</html>
EXPLANATION
1
A rule is defined for a table cell. The table's data will be blue, the font size 18
points, and the font family, Verdana. Whenever you create a table, each of the table
cells, defined by the <td> tag, will have this style.
2-4
The table data in these cells will take on the style described in line 1. The output
is shown in Figure 14.21.
 
Search WWH ::




Custom Search