Forum How do I...?

Long caption over narrow table breaks at table width

cayhorstmann
The following table has a long caption that I would like to see as a single line.
    <table id='ch05table01'>
      <caption>Hash Codes Resulting from the <code>hashCode</code> Method</caption> 
      <thead>
        <tr>
          <td>
            <p>String</p> 
          </td> 
          <td>
            <p>Hash Code</p> 
          </td> 
        </tr> 
      </thead> 
      <tbody>
        <tr>
          <td>
            <p><code>Hello</code></p> 
          </td> 
          <td>
            <p><code>69609650</code></p> 
          </td> 
        </tr> 
        <tr>
          <td>
            <p><code>Harry</code></p> 
          </td> 
          <td>
            <p><code>69496448</code></p> 
          </td> 
        </tr> 
        <tr>
          <td>
            <p><code>Hacker</code></p> 
          </td> 
          <td>
            <p><code>-2141031506</code></p> 
          </td> 
        </tr> 
      </tbody> 
    </table> 

That's what a browser does. But Prince breaks it into multiple lines, creating a skinny paragraph that sits above the two narrow columns. How can I avoid that?
mikeday
Firefox appears to match the Prince behaviour here, perhaps you could specify an absolute width for the table caption (e.g. in cm or in units)? That should consistently work in both. Unfortunately percentage widths appear to behave differently.
cayhorstmann
Thanks very much! You are right, I had a rule table caption { width: 100% }, and that doesn't work in Prince. I think it should. For now, I added a @media print rule that hardcodes a suitable width in em.