is expanded to parent 的宽度和高度如何? ? 我正在使用React,并且必须扩展<a>中的<td>元素以适合<td>的宽度和高度。这意味着当我单击<td>元素时,<a>的超链接必须能够按预期工作。如何实现此行为没有position属性? 我知道position属性可以解决此问题,但是使用此属性可能会更糟。因此,我想在没有此属性的情况下解决此问题。 HTML <table> <tr> <td><a href="https://google.com">td1</a></td> <td><a href="https://google.com">td2</a></td> <td><a href="https://google.com">td3</a></td> <td><a href="https://google.com">td4</a></td> </tr> </table> CSS td { border: 1px solid red; padding: 16px; cursor: pointer; } a { text-decoration: none; color: inherit; } td:hover a { color: purple; } Context 我正在使用CSS框架,无法删除padding的td [a必须覆盖width的height和td 我正在研究React和 element in 必须扩展为适合 的宽度和高度。这意味着当我单击 元素时, has to work as ... ]

问题描述 投票:0回答:1

我正在使用React,并且必须扩展<a>中的<td>元素以适合<td>的宽度和高度。这意味着当我单击<td>元素时,<a>的超链接必须能够按预期工作。如何实现此行为没有position属性?

css html-table hyperlink
1个回答
0
投票

© www.soinside.com 2019 - 2024. All rights reserved.