gpt4 book ai didi

html - 图片应该链接而不是背景

转载 作者:太空宇宙 更新时间:2023-11-04 09:14:32 25 4
gpt4 key购买 nike

我需要在图片上设置链接。我必须将其设置在表格中,我确实这样做了。但我不明白为什么图片以全宽链接。这意味着背景颜色也是一个链接。该链接应该只在图片上。

如果它是一个 div 标签,它可以用包装器解决,但我不知道如何在表格中解决?

My Example

这是我的代码:

<body>
<table class="wrapper" align="center">
<tr>
<td class="wrapper-inner">
<!-- Row 1 -->
<table class="row collapse" >
<tbody>
<tr>
<th class="small-12 large-12 columns first">
<table>
<tr>
<th>
<a href="https://www.google.dk/"><img src="http://3.bp.blogspot.com/-Z4vZ7AsD6Bc/T_PNRK_9f2I/AAAAAAAAAH4/t3UZ3BQyqdE/s1600/shutterstock.jpg" alt="test" align="center" class="float-center" ></a>
</th>
<th class="expander"></th>
</tr>
</table>
</th>
</tr>
</tbody>
</table>
<!-- Row 2 -->
<table class="row collapse bgcolor--blue">
<tbody>
<tr>
<th class="small-12 large-12 columns">
<table>
<tr>
<th>
<a href="https://www.google.dk/"><img src="http://24.media.tumblr.com/7a40daf7853d830815fb83f79752e94a/tumblr_mz2izkaidT1rfn9zxo4_500.png" alt="Fashion news" align="center" class="float-center"></a>
</th>
<th class="expander"></th>
</tr>
</table>
</th>
</tr>
</tbody>
</table>
</td>
</tr>
</table>
</body>

最佳答案

我没有注意到会发生这种情况。试试这个 CSS:

th {
text-align: center;
}

th a {
display: inline-block;
}

编辑使用@SpencerMay评论

关于html - 图片应该链接而不是背景,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41852592/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com