Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

html - table row like a link

I can't set my table row as link to something. I can use only css and html. I tried different things from div in row to something another, but still can't make it works.

like image 236
Max Frai Avatar asked Sep 22 '09 15:09

Max Frai


People also ask

How do you make a row a clickable table in HTML?

Using <a> tag inside <td> One more way to make the whole row clickable is to add an <a> inside every <td> element. Along with it add hover to the row which we want to make clickable and use display: block property to anchor to make the whole row clickable.

How do you make a row a link?

To add hyperlinks to an existing Hyperlinks section, right-click a row and click Insert Row on the shortcut menu. You can reference these cells by their row name, which appears in a ShapeSheet window in red text. To assign meaningful names to Hyperlink.

How do you hyperlink a table in HTML?

A link is defined using the <a> tag. You can add the link text or images and another web pages.

How do you make a cell hyperlink in a table?

You just put an img tag inside the table cell (< td > tag). The src attribute's value can be any valid URL of an image on the Web , local or remote.


1 Answers

You have two ways to do this:

  • Using javascript:

    <tr onclick="document.location = 'links.html';">

  • Using anchors:

    <tr><td><a href="">text</a></td><td><a href="">text</a></td></tr>

I made the second work using:

table tr td a {     display:block;     height:100%;     width:100%; } 

To get rid of the dead space between columns:

table tr td {     padding-left: 0;     padding-right: 0; } 

Here is a simple demo of the second example: DEMO

like image 114
Esteban Küber Avatar answered Sep 18 '22 04:09

Esteban Küber