tags:

views:

291

answers:

2
<style>
.special p { display:none; }
.special:hover p { display:block; }
</style>

<table>
  <tr>
    <td style="width:200px">Things</td>
    <td style="position:relative; width:220px">
      <div style="position:absolute;right:0" class="special">
        <img id="shows" />
        <p>Variable width upto, say 600px (Will be hidden until this td is :hovered</p>
      </div>
    </td>
  </tr>
  <tr>
    <td style="width:200px">Things</td>
    <td style="position:relative; width:220px">
      <div style="position:absolute;right:0" class="special">
        <img id="shows" />
        <p>Variable width upto, say 600px (Will be hidden until this td is :hovered</p>
      </div>
    </td>
  </tr>
</table>

Can I make this work? Ie, can I make the #special p expand over the top of 'Things'? As I currently have it set up #special won't ever grow outside the 220px wide td. Any ideas?

+1  A: 

I am still not fully clear, but try this. This will allow the TD to grow when the content is displayed.

<table>
  <tr>
    <td style="width:200px">Things</td>
    <td style="text-align: right;">
      <div class="special">
        <img id="shows" />
        <p>Variable width upto, say 600px (Will be hidden until this td is :hovered</p>
      </div>
    </td>
  </tr>
</table>
Dustin Laine
That'll work for my simplified example, but if there are two rows with this behaviour (I'll update my question) then the 'special' elements won't remain in line with that row. The irritating bit is that changing to `tr { position:relative }` (as you suggest) doesn't seem to be working for me
JP
Hmm, it appears blocks displaying as `table-xx` won't accept the `position:relative` trick (at least not on FF3.6). That's a bummer.
JP
Because you have the TD a set width can you just add `left: -200px` to your `special`. That will cover the 'things'.
Dustin Laine
Apologies, the aim isn't to fully cover the td, but to allow the special to take up as much room as it might need. Any idea why table elements don't allow the postition:relative trick?
JP
Check my update
Dustin Laine
You can see what I'm trying to achieve by installing a gem I've just released (if you're so inclined) `gem install Thimblr`. If you're interested in what it is: http://toys.byjp.me/thimblr - roll over the green arrows once you've got thimblr running.
JP
Can you put up a demo?
Dustin Laine
A: 

I'm not 100% sure what you are trying to achieve, but wow about taking away the position: relative from the td and making the .special p s position: absolute but not the special elements themselves?

That way, your special elements will be in the normal table flow, and the paragraphs popping up will leave the table cell's boundaries.

Pekka