caption-side property in CSS

It specifies the placement of table caption.It has the Following Three Values: Top,Bottom,Inherit.Top is used to put the caption in the Top. Bottom is used to put the caption in the Bottom. and in Inherit, we can specify the value of it.

Here we take an Example of Top:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
<html>
<head>
<style type="text/css">
caption {caption-side:top;}
</style>
</head>

<body>

<table border="1">
<caption>Student's Data</caption>
<tr>
  <th>Name</th>
  <th>Place</th>
  <th>Country</th>
</tr>
<tr>
<td>Mahak</td>
<td>Jaipur</td>
<td>India</td>
</tr>
<tr>
<td>Pihu</td>
<td>Gurgaon</td>
<td>India</td>
</tr>
</table>
</body>
</html>


Output:



1.png

Note: IE supports this property only when we specify !DOCTYPE in our program.

Ebook Download
View all
Learn
View all