There is a Hake that can help you, you put position: relative
in td
and if you have a <a>
direct son of td
, will have a pseudo-element that will cover the entire cell of td
and put the background color.
See the example, note that regardless of the position of the <a>
in the content of td
the color will always cover the whole cell.
td {
position: relative;
border: 1px solid #000;
}
td > a:first-of-type::before {
position: absolute;
z-index: -1;
content: "";
top: 0;
bottom: 0;
left: 0;
right: 0;
background-color: tomato;
}
<table>
<tr>
<th>Link</th>
<th>Descrição</th>
</tr>
<tr>
<td>Fonts para web</td>
<td>
<a href="https://fonts.google.com/">link</a>
<a href="https://fonts.google.com/">link1</a>
<a href="https://fonts.google.com/">link2</a>
<a href="https://fonts.google.com/">link3</a>
</td>
</tr>
<tr>
<td>Caracteres especias</td>
<td>texto qualquer</td>
</tr>
<tr>
<td>Caracteres especias</td>
<td>
<span>texto + link</span>
<br>
<a href="https://fonts.google.com/">link3</a>
</td>
</tr>
</table>
Important you [Dit] your question and explain objectively and punctually the difficulty found, accompanied by a [mcve] of the problem and attempt to solve. To better enjoy the site, understand and avoid closures and negativities worth reading the Stack Overflow Survival Guide in English.
– Bacco