Skip to content Skip to sidebar Skip to footer

Table Row As Anchor

I'm trying to set my entirely table row as an anchor. I've read here that It's not a good practice to put all table row content inside a anchor tag because the html standard doesn'

Solution 1:

All major browsers since IE7 support the :hover CSS pseudoclass on all elements, including tr, so you don't need to use an anchor to style the hover state.

As for your other question, take a look at this answer: Make link in table cell fill the entire row height

Solution 2:

I am not sure what you are trying to do with the anchor. I have a table used to display rows of an SQL table. As PHP creates the table it inserts an onclick into each row header with the index of the row as an argument. No anchor is used.

while ($row = mysql_fetch_array($result)) {
    $id = $row['resv_id'];
    $funct_call="Edit_Row($id)";
    echo"<tr " . "onclick=$funct_call" .  " >";
}

The onclick function body is:

var target="./entry_form.php?submit=Edit&resv_id=index_num";
window.open( target.replace("index_num",id),'_self' );

Solution 3:

put inside each td of the row an anchor tag and put inside the anchor tag a div But you need to give it a height (it's better to give it a min-height as if the content needed to expand)


.link {
width:100%;
min-height:100px; /**For example**/

}
<tr><td><a><divclass="link"></div></a></td><td><a><divclass="link"></div></a></td><td><a><divclass="link"></div></a></td></tr>

Post a Comment for "Table Row As Anchor"