开发者

How to make whole table cell clickable but vertical align text inside it - CSS

开发者 https://www.devze.com 2023-04-07 17:46 出处:网络
How to make whole table cell clickable but vertical align text inside it. Alright it is achievable by making link display:block and setting line height.

How to make whole table cell clickable but vertical align text inside it.

Alright it is achievable by making link display:block and setting line height.

But the problem开发者_如何学运维 is text may get 2 lines some times. So this way is not solution. Are there any other solution ?

thank you.


You could do this by adding a class to the cell you want to click and hooking this up using jquery such as

<td class="clickable">...</td>

your jquery...

$('.clickable').click(function() {
   alert('Table cell has been clicked');
 });


Yes you could do that but I usually need each cell to do something different or to send a different piece of data for each cell. So I use something like this.

<td onclick="update_calendar(1337317200);">19</td>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号