genesis
genesis

Reputation: 50976

table - absolute positioning (simple question)

I have a small problem. I've got table like this

 <table border="1">
        <tr style="position:relative;">
            <td>
                  <a href="link.php?l">Click here to redirect yourself</a>
                  <span onclick="ajax_redir();" style="position:absolute;right:5px;">
                       AJAX
                  </span>
            </td>
        </tr>   
    </table>

my problem is that AJAX is placed in the right corner of my screen. What am I doing wrong? (I am trying to make AJAX text in corner of actual <td></td>)

demo of my problem http://jsfiddle.net/ehtwW/

Upvotes: 1

Views: 8661

Answers (2)

Luc125
Luc125

Reputation: 5857

The TD has to be relatively positioned. For the TR it is not necessary:

<table border="1">
    <tr>
        <td style="position:relative;">
              <a href="link.php?l">Click here to redirect yourself</a>
              <span onclick="ajax_redir();" style="position:absolute;right:5px;">
                   AJAX
              </span>
        </td>
    </tr>   
</table>

Upvotes: 2

Iulius Curt
Iulius Curt

Reputation: 5114

It is actually kind of strange, but it seems that if you wrap all the contents of the td in a div it will work.

Just like this: http://jsfiddle.net/Gm5fg/1/

Upvotes: 3

Related Questions