Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to strech a link over the whole cell?

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:

enter image description here

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

like image 885
Tim Büthe Avatar asked Feb 03 '12 10:02

Tim Büthe


1 Answers

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/

like image 183
zobier Avatar answered Sep 19 '22 16:09

zobier