Table cell with line height setting : td « Tags « HTML / CSS






Table cell with line height setting

     


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <title>Vertical alignment across a table row using vertical-align: baseline</title>
  <style type="text/css" media="all">
    table {
      font: 1em/1.5em Georgia, serif;
      border: 1px solid black;
      margin: 1em 1em 0 1em;
    }
    td {
      width: 10em;
      line-height: 1.5em;
      padding: 0.25em;
      border: 1px dashed black;
    }
    table.type1 td {
      vertical-align: top;
    }
    table.type2 td {
      vertical-align: baseline;
    }
    td.two {
      line-height: 2.5em;
    }
    td.three {
      line-height: 2em;
    }
  </style>
</head>
<body>
  <table class="type1">
    <tr>
      <td>this is a test. </td>
      <td class="two">this is a test. </td>
      <td class="three">this is a test. </td>
    </tr>
  </table>
  <table class="type2">
    <tr>
      <td>this is a test. </td>
      <td class="two">this is a test. </td>
      <td class="three">this is a test. </td>
    </tr>
  </table>
</body>
</html>

   
    
    
    
  








Related examples in the same category

1.'td' Example
2.'choff' is a decimal number specifying an offset from the beginning of the table cell
3.'headers' specifies a list of 'th' elements
4.tr and td
5.Line break in a table cell
6.use table cell as block
7.Hide empty cell
8.Empty table header cell
9.Table cell hover
10.Right-offset Shrinkwrapped Table
11.Table with Spanned Rows and Cells
12.Boxed Table and Cells
13.td font-weight: bold;
14.table cell hover with class
15.td:empty
16.table cell overflow hidden
17.Selecting cells in body
18.Set style for an anchor in table cell
19.Set style for image in a table cell
20.Table cell with different class
21.Add different cell space
22.empty-cells: hide
23.td width:6em;
24.td overflow: hidden;
25.td font-size: 130%;
26.td color: #303030;
27.td font-size: 0.9em;
28.td line-height:1.5; line-height:1.5em; line-height:75%;}
29.Table with column span 2
30.Table with number column
31.css is for the table layout
32.rowspans and colspans merge the specified number of cells vertically or horizontally
33.Selecting cells in column
34.Column widths
35.Hiding column
36.col width: 200px;
37.col color: crimson;
38.Column highlight