如何在整个单元格链接? [英] How to strech a link over the whole cell?

查看:140
本文介绍了如何在整个单元格链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个表,其中包含可以点击编辑行的链接(锚点)。 我想将这些链接拉伸到包含单元格的全部宽度和高度。我已将它们设置为 display:block; 全宽:

I have a table that includes links (anchors) that can be clicked to edit the row. I want these links to be stretched to the full width and height of the containing cell. I already set them to display: block; so they have the full width:

>

问题是,我无法使用CSS使他们达到完全高度。请参阅我的示例: http://jsfiddle.net/timbuethe/53Ptm/2/

The problem is, I have trouble getting them to full height using CSS. See my example fiddle here: http://jsfiddle.net/timbuethe/53Ptm/2/.

推荐答案

在块元素上设置任意大的负边距和相等的填充, >

Set an arbitrarily large negative margin and equal padding on the block element and overflow hidden on the parent.

td {
    overflow: hidden;
}
td a {
    display: block;
    margin: -10em;
    padding: 10em;
}

http://jsfiddle.net/53Ptm/43/

这篇关于如何在整个单元格链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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