The CSS reference

"caption-side" - css property (v. css 2)

  • To specify the placement of a table caption
  • Initial value: top
  • The property is inherited
  • HTML usage: 'table-caption' elements
  • Browsers that support the caption-side - property :
    Internet Explorer Mozilla Firefox Opera Google Chrome Apple Safari

Possible caption-side values:

value Comments CSS
top Positions the caption box above the table box. 2
bottom Positions the caption box below the table box. 2
inherit Will inherit the value from parent specification. 2

Property "caption-side" example:

<!DOCTYPE HTML >
<html  >
  <head>
    <title>Test</title>
    <script type="text/javascript" >
    </script>
    <style   type="text/css">
      table { border-spacing: 10px;
              height: 200px; width:300px; }
     </style>
  </head>
  <body >
    <table border="1" >
      <caption style="caption-side: bottom;">
        This is the table caption
      </caption>
      <tr >
        <td >This</td>
        <td >table</td>
        <td >has</td>
      </tr>
      <tr >
        <td >a</td>
        <td >10px </td>
        <td >border-spacing</td>
      </tr>
    </table>
  </body>
</html>

Javascript access:

// To SET values ([o] is the target object)
[o].style.captionSide="caption-side value"
// To GET values you must first get the computed style object
// To get that object in IE or Opera:
var cStyle=[o].currentStyle;
// To get that object in Firefox, Chrome or Safari (w3c-type):
var cStyle=window.getComputedStyle([o],null)
// To GET the property value:;
var value=cStyle.captionSide;
© 2010 by Finnesand Data. All rights reserved.
This site aims to provide FREE programming training and technics.
Finnesand Data as site owner gives no warranty for the correctness in the pages or source codes.
The risk of using this web-site pages or any program codes from this website is entirely at the individual user.