us
tagline

 Home/  Tutorials/  HTML/  tables/  add a heading to a table/  arrowyou are here

 Tutorials Tutorials

 a. HTML

 1. tables

 Add a heading to a table

We're going to use the <caption> tag to add a heading to a table like this:

Our Ships
Ship Speed
Dragon Ship slow
Ferry slow
  1. write a table in the code
    <table border="1">
    	<tr>
    		<td><b>Ship</b></td>
    		<td><b>Speed</b></td>
    	</tr>
    	<tr>
    		<td>Dragon Ship</td>
    		<td>slow</td>
    	</tr>
    	<tr>
    		<td>Ferry</td>
    		<td>slow</td>
    	</tr>
    </table>
    		
  2. save the code and open the page in a browser
    you'll see this:
    Ship Speed
    Dragon Ship slow
    Ferry slow
  3. Now, let's add a heading by writing this in the table code:
    <table border="1">
    	<caption>Our Ships</caption>
    	<tr>
    		<td><b>Ship</b></td>
    		<td><b>Speed</b></td>
    	</tr>
    	<tr>
    		<td>Dragon Ship</td>
    		<td>slow</td>
    	</tr>
    	<tr>
    		<td>Ferry</td>
    		<td>slow</td>
    	</tr>
    </table>
    		
  4. save the code and open the page in a browser
    you'll see this:
    Our Ships
    Ship Speed
    Dragon Ship slow
    Ferry slow

    the title "Our Ships" has been added above the table!

more tutorials to try

you might like to try these tutorials too:



PayPal verified merchant
Find Us on Facebook
Allstate