HTML and CSS Reference
In-Depth Information
EXAMPLE
14.14 (
CONTINUED
)
<body>
5
<
table
border=0
class="size"
>
6
<tr><td><img src="indiacows.jpg" width="200"
height="150" alt="Cows Rule"></td></tr>
7
<tr>
<td class="caption"
>Some cows take a leisurly stroll
down the Jayanagar Block after a morning rain in
Bengaluru, India.</td></tr>
</table>
</body>
</html>
EXPLANATION
1
The CSS style sheet starts here.
2
The
table
and the
td
elements are given a grooved dark green border.
3
This is a class to define the width of an HTML element.
4
This style defines a class called
.caption
defining font size and style of an HTML
element.
5
The class attribute of the HTML table defines the width of the table.
6
The first row and cell of the table is the image. Its border was defined as grooved
and dark green in the CSS on line 2.
7
The second row of the table contains a class called “caption” to style the text font
in the cell. This cell also uses the style for a grooved, green border. The output is
shown in Figure 14.15.
Figure 14.15
A table with an image and text from Example 14.14.