how to make a whole row in a table clickable as a link?

Total Post:102

Points:714
 4749  View(s)
Ratings:
Rate this:

Is it possible to make a whole row clickable as a link? I'm using bootstrap andthe following doesn't work:

<tbody>

    <a href="#">

        <tr>

            <td>Blah Blah</td>

            <td>1234567</td>

            <td>£158,000</td>

        </tr>

    </a>

</tbody>

  1. Post:412

    Points:2888
    Re: how to make a whole row in a table clickable as a link?

    Hi Mark,

    You could include an anchor inside every <td>, like so:

    <tr>
      <td><a href="#">Blah Blah</a></td>
      <td><a href="#">1234567</a></td>
      <td><a href="#">more text</a></td>
    </tr>
    You could then use display:block; on the anchors to make the full row clickable.
    tr:hover {
       background: red;
    }
    td a {
       display: block;
       border: 1px solid black;
       padding: 16px;
    }

      Modified On Mar-31-2018 02:01:39 AM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!