将锚元素的大小扩展为父表单元格的大小 [英] Expand size of anchor element to the size of the parent table cell

查看:144
本文介绍了将锚元素的大小扩展为父表单元格的大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我基本上有以下:

 < table& 
< thead>
< tr>
< th>标题< / th>
< / tr>
< / thead>
< tbody>
< tr>
< td>
< a href =...>< / a>
< / td>
< / tr>
< / tbody>
< / table>

假设表单元格有一些宽度和高度,由附加表格单元格和表格



我需要锚点元素展开到相同的表格单元格的宽度和高度,这样你可以点击单元格内的任何地方获得链接。

澄清 将表格单元格设置为具有固定宽度或高度不是有效选项。

解决方案

将锚点的样式设置为:

  style =display:block; height:100%; width:100%; 


I basically have the following:

<table>
  <thead>
    <tr>
      <th>Header</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <td>
        <a href="..."></a>
      </td>
    </tr>
  </tbody>
</table>

Assume that the table cell has some width and height to it, as created by additional table cell and table header elements.

I need that anchor element to expand to the same width and height of the table cell so that you can click anywhere within the cell to get to the link. How does one do this so that it's cross-browser compatible?

Clarification Setting the table cell to have a fixed width or height is not a valid option.

解决方案

set the style of the anchor to:

 style="display: block; height: 100%; width:100%;"

这篇关于将锚元素的大小扩展为父表单元格的大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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