tags:

views:

23

answers:

1

I'm trying to shrink the caption box to fit its text content. Here's what I have:

alt text

Here's what I'm after:

alt text

The usual methods of float, display:inline/inline-block/table all cause variants of the following:

alt text

in which the caption is broken out of the flow and becomes treated as a child element of the table's box.

The table code is nothing special:

<table>
<caption>Legendary fictional heroes</caption>
<thead>
    <tr>
        <th>Name</th><th>Power</th><th>Nemesis</th>
    </tr>
</thead>
<tbody>
    <tr>
        <td>Dazzler</td><td>Sound-to-Light Transformation</td><td>Apocalypse</td>
    </tr>
    ...
</tbody>  </table>

Any ideas on how to accomplish what I want? Thanks in advance.

A: 

You can't make one row in the table smaller then the others. Why don't you place the caption outside the table using div with correct background-color?

Alex Reitbort
I'm talking about the CAPTION HTML tag, a daughter tag of TABLE. It would be easy enough to do this with a paragraph otherwise, but CAPTION is a required element for accessible tables.
Superstringcheese