XML technologies / ePUB / Open Publication Structure / Tables / Tables with spanning cells
(Excerpt from “E-Books mit ePUB ─ Von Word zum E-Book mit XML” by Dr. Victor Wang)
Joining table cells horizontally or vertically creates spans, controlled by the attributes colspan for horizontal and rowspan for vertical spans. Integer values specify how many cells to span from the current one. The example spans the last two cells in rows 2 and 3:
<?xml version="1.0" encoding="UTF-8"?>
<!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="de">
<head>
<title>Tabellen in XHTML</title>
<link rel="stylesheet" type="text/css" href="xhtml-styles.css"/>
</head>
<body>
<div class="Gliederungsebene">
. . .
<h1>Tabelle horizontaler Überspannung (colspan=2)</h1>
<table border="1" width="400">
<caption>Wichtige Elemente in DTBook</caption>
<col width="25%"/>
<col width="50%"/>
<col width="25%"/>
<thead>
<tr>
<th>Zeile</th>
<th>Elementname</th>
<th>Bedeutung</th>
<th>Besondere Attribute</th>
</tr>
</thead>
<tbody>
<tr>
<td>1</td>
<td>level</td>
<td>Kapitelstruktur/Ebene in DTBook</td>
<td>depth</td>
</tr>
<tr>
<td>2</td>
<td>hd</td>
<td colspan="2">Überschrift einer Level-Ebene in DTBook</td>
</tr>
<tr>
<td>3</td>
<td>p</td>
<td colspan="2">Absatz in DTBook</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
Code example: Spanning cells in XHTML
Figures: XHTML table with Colspan (Adobe Digital Editions and iBooks)
The readers Adobe Digital Editions and iBooks display the results above. Spanned cells are shaded gray through the stylesheet for clarity.
Copyright © mitp 2011
You may print the online version for your private use.
Otherwise, this chapter from “E-Books mit ePUB” is subject to the same terms as the printed edition: the work and all its parts are protected by copyright. All rights reserved, including reproduction, translation, microfilming, and storage and processing in electronic systems.
Verlagsgruppe Hüthig Jehle Rehm GmbH, Im Weiher 10, 69121 Heidelberg, kundenbetreuung(at)hjr-verlag.de
back to top