Switch to full style
HTML code examples
Post a reply

adding caption to table in html

Fri Dec 16, 2011 10:11 pm

add caption to the table in html using the caption tag within the table tag itself. You can set the style of the caption and also its value.

Code:

    
<html>
<
head>
<
title>caption element example</title>
</
head>
<
body>
   <center>
       <table 
              width
="300" 
              border
="2" 
              cellspacing
="2" 
              cellpadding
="2" 
              align
="center">
          <caption  valign="bottom" style="color:blue">
             Table 1-1. Test results for midterm examples
          
</caption>
          <tr>
          <th>Subject 1</th>
          <th>Subject 2</th>
          </tr>
          
          
<tr>
              <td>32</td>
              <td>31</td>
          </tr>
          <tr>
              <td>54</td>
              <td>52</td>
          </tr>
       </table>
   </center>
</
body>
</
html>
 




Post a reply
  Related Posts  to : adding caption to table in html
 put caption at the bottom of table     -  
 adding abbreviations to your html     -  
 DDL Statements-Adding Constraints-CREATE-ALTER-TABLE     -  
 HTML Scrollable table     -  
 HTML Table Of Contents Generator     -  
 Sort HTML table from JQuery     -  
 Use for loop to output HTML table     -  
 adding padding to your text     -  
 Adding a New Node to contact.xml     -  
 Need automatic adding to catalogs     -  

Topic Tags

HTML Table