mirror of
https://github.com/clagnut/webtypography.git
synced 2025-09-02 09:33:27 +02:00
102 lines
4.5 KiB
HTML
102 lines
4.5 KiB
HTML
<blockquote class='quote-from-book'> <p><span class='ic'>“</span>Lists, such as contents pages and recipes, are opportunities to build architectural structures in which space between the elements both separates and binds. The two favourite ways of destroying such an opportunity are setting great chasms of space that the eye cannot leap without help from the hand, and setting unenlightening rows of dots that force the eye to walk the width of the page like a prisoner being escorted back to its cell.”</p>
|
||
</blockquote>
|
||
<p>The <dfn>dot leader</dfn> approach to which Bringhurst alludes is the default presentation for tables of contents in Microsoft Word. Fortunately this kind of layout is tricky to accomplish in <abbr title="Cascading Style Sheets">CSS</abbr> so it is rarely seen in web pages. Bringhurst goes on to present two alternative layouts for tables of contents which are replicated here:</p>
|
||
|
||
<h2>Example 1 – Table of contents aligned right</h2>
|
||
|
||
<div class="example"><table class="ex2-1-10-toc1">
|
||
<tr><th>Introduction</th><td>7</td></tr>
|
||
<tr><th>Chapter <strong>1</strong> The Sex of Centaurs</th><td>11</td></tr>
|
||
<tr><th>Chapter <strong>2</strong> Poliphilo’s Dream</th><td>11</td></tr>
|
||
</table></div>
|
||
|
||
<p>This is a table of contents so it has been marked up as a simple table:</p>
|
||
|
||
<pre><code><table>
|
||
<tr>
|
||
<th>Introduction</th>
|
||
<td>7</td>
|
||
</tr>
|
||
<tr>
|
||
<th>
|
||
Chapter <strong>1</strong>
|
||
The Sex of Centaurs
|
||
</th>
|
||
<td>11</td>
|
||
</tr>
|
||
<tr>
|
||
<th>
|
||
Chapter <strong>2</strong>
|
||
Poliphilo&#8217;s Dream
|
||
</th>
|
||
<td>11</td>
|
||
</tr>
|
||
</table></code></pre>
|
||
|
||
<p>The <abbr title="Cascading Style Sheets">CSS</abbr> looks like this:</p>
|
||
|
||
<pre><code>table {
|
||
margin: 0 3em 0 auto;
|
||
}
|
||
|
||
th {
|
||
font-weight: normal;
|
||
text-align: right;
|
||
padding: 0;
|
||
}
|
||
|
||
td {
|
||
font-style: italic;
|
||
text-align: right;
|
||
padding: 0 0 0 0.5em;
|
||
}</code></pre>
|
||
|
||
<p>While most of the <abbr title="Cascading Style Sheets">CSS</abbr> is straight forward, a point worth highlighting is the <code>margin</code> declaration for the <code>table</code> itself. There is a right margin of 3 em to set the table in slightly from the right gutter and a left margin of <code>auto</code> to push the table over towards the right hand side of the page.</p>
|
||
|
||
<h2>Example 2 – Centred table of contents</h2>
|
||
|
||
<div class="example"><table class="ex2-1-10-toc2">
|
||
<tr><th>Prologue</th><td>page 5</td></tr>
|
||
<tr><th>Points of Possible Agreement</th><td>page 9</td></tr>
|
||
<tr><th>Irreconcilable Differences</th><td>page 11</td></tr>
|
||
<tr><th>Conclusion</th><td>page 163</td></tr>
|
||
<tr><th>Index</th><td>page 164</td></tr>
|
||
</table></div>
|
||
|
||
<p>Again a simple table has been used for the markup:</p>
|
||
|
||
<pre><code><table>
|
||
<tr><th>Prologue</th><td>page 5</td></tr>
|
||
<tr><th>Points of Possible Agreement</th><td>page 9</td></tr>
|
||
<tr><th>Irreconcilable Differences</th><td>page 11</td></tr>
|
||
<tr><th>Conclusion</th><td>page 163</td></tr>
|
||
<tr><th>Index</th><td>page 164</td></tr>
|
||
</table></code></pre>
|
||
|
||
<p>The <abbr title="Cascading Style Sheets">CSS</abbr> looks like this:</p>
|
||
|
||
<pre><code>table {
|
||
margin: 0 auto;
|
||
}
|
||
|
||
th {
|
||
font-weight: normal;
|
||
text-align: right;
|
||
padding: 0 0.5em 0 0;
|
||
}
|
||
|
||
td:before {
|
||
content: "2022";
|
||
padding-right: 0.5em;
|
||
}
|
||
|
||
td {
|
||
font-style: italic;
|
||
text-align: left;
|
||
padding: 0;
|
||
}</code></pre>
|
||
|
||
<p>There a couple of points worth noting in the <abbr title="Cascading Style Sheets">CSS</abbr>. The table has been centered by giving the left and right margins a value of <code>auto</code>. For block-level elements a <code>width</code> declaration would also be required when applying this technique, however tables have an inherent width so one does not need to be specified explicitly.</p>
|
||
|
||
<p>The bullet points separating chapter titles and page numbers have been generated by the <abbr title="Cascading Style Sheets">CSS</abbr>. Specifically a bullet point <span class='bracket'>(</span>Unicode character 2022<span class='bracket'>)</span> has been inserted before the <code>td</code> element. Generated content is not supported by Internet Explorer 6 or 7, so a more cross-browser alternative would be to write a bullet point entity <code>&#8226;</code> into the markup itself.</p>
|
||
|