table-intro-example-002.xht (1732B)
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> 2 <html xmlns="http://www.w3.org/1999/xhtml"> 3 <head> 4 <title>CSS Test: Introduction to Tables (vertical-align)</title> 5 <link rel="author" title="Microsoft" href="http://www.microsoft.com/" /> 6 <link rel="help" href="http://www.w3.org/TR/CSS21/tables.html#tables-intro" /> 7 <meta name="assert" content="'vertical-align' can be set on table cells (example from section 17.1)." /> 8 <style type="text/css"> 9 caption 10 { 11 color: blue; 12 } 13 td 14 { 15 border: 1px solid blue; 16 height: 5em; 17 vertical-align: middle; 18 width: 10em; 19 } 20 th 21 { 22 border: 1px solid blue; 23 height: 5em; 24 vertical-align: baseline; 25 width: 10em; 26 } 27 </style> 28 </head> 29 <body> 30 <p>Test passes if the text in the left-most box column is at the very top of the column and text in the other two columns is vertically centered.</p> 31 <table> 32 <caption>This is a simple 3x3 table</caption> 33 <tr id="row1"> 34 <th>Header 1</th> 35 <td>Cell 1</td> 36 <td>Cell 2</td> 37 </tr> 38 <tr id="row2"> 39 <th>Header 2</th> 40 <td>Cell 3</td> 41 <td>Cell 4</td> 42 </tr> 43 <tr id="row3"> 44 <th>Header 3</th> 45 <td>Cell 5</td> 46 <td>Cell 6</td> 47 </tr> 48 </table> 49 </body> 50 </html>