HOW TO MAKE A WHOLE ROW IN A TABLE CLICKABLE AS A LINK?

Mark Devid

Total Post:102

Points:714
Posted by  Mark Devid
 4061  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. Pravesh Singh

    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;

    }

Answer

NEWSLETTER

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