XHTML element: th

Tabeli päiselahter. Peab asuma tr elemendi sees.

Nõutavad atribuudid:

Valikulised atribuudid:

Standardsed atribuudid

Neid saab määrata suuremale osale elementidest:

Näited

Võimalikult keeruline CSSi abil stiliseeritud ning andmete salvestamiseks mõeldud tabeli näidis.

<?xml version="1.0" encoding="iso-8859-1"?>
<!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="et" lang="et">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title></title>

<style type="text/css">
.tulp1 {
  background-color: red;
  color: inherit;
  width: 100px;
}
.tulp2ja3 {
  background-color: yellow;
  color: inherit;
  width: 100px;
}
.tulp4 {
  background-color: green;
  color: inherit;
  width: 100px;
}
table {
  border-collapse: collapse;
  border-left: 1px solid gray;
  border-right: 1px solid gray;
  border-bottom: 1px solid gray;
}
td, th, caption {
  font-family: arial, helvetica, sans-serif;
  font-size: 0.8em;
  padding: 0.4em;
}
caption {
  border-left: 1px solid gray;
  border-right: 1px solid gray;
  border-top: 1px solid gray;
}
</style>

</head>
<body>

<table>
  <caption>See on tabeli kirjeldus</caption>
  <colgroup>
    <col class="tulp1" align="left" />
    <col class="tulp2ja3" span="2" align="center" />
    <col class="tulp4" align="right" />
  </colgroup>
  <thead>
    <tr>
      <th>esimene</th>
      <th>teine</th>
      <th>kolmas</th>
      <th>neljas</th>
    </tr>
  </thead>
  <tfoot>
    <tr>
      <th>esimene</th>
      <th>teine</th>
      <th>kolmas</th>
      <th>neljas</th>
    </tr>
  </tfoot>
  <tbody>
    <tr>
      <td>1</td>
      <td>2</td>
      <td>3</td>
      <td>4</td>
    </tr>
    <tr>
      <td>5</td>
      <td>6</td>
      <td colspan="2">7</td>
    </tr>
    <tr>
      <td colspan="2">8</td>
      <td>9</td>
      <td>10</td>
    </tr>
  </tbody>
</table>

</body>
</html>

© Margo Munner | Sisukaart