html - 表格行就像一个链接 [英] html - table row like a link

查看:12
本文介绍了html - 表格行就像一个链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我无法将表格行设置为指向某些内容的链接.我只能使用 css 和 html.我尝试了从 div in row 到另一个不同的东西,但仍然无法使其正常工作.

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.

推荐答案

您有两种方法可以做到这一点:

You have two ways to do this:

  • 使用 JavaScript:

  • Using javascript:

使用锚点:

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

我使用:

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

消除列之间的死区:

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

这是第二个例子的简单演示:DEMO

Here is a simple demo of the second example: DEMO

这篇关于html - 表格行就像一个链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆