user2889693
user2889693

Reputation: 155

How to put a border around the whole cell?

I want that the "innerborder" is around the whole cell, if focused. Right now its just around the length of the word. I want that the border goes around the whole cell. Which is the code sniped which I should add ?

td:focus{
    border: 2px inset white;
    border-width:2px;
    content: '';
    width: auto;
    height: auto;
    position: absolute;
    background: white;
}

Upvotes: 0

Views: 72

Answers (1)

James Donnelly
James Donnelly

Reputation: 128786

It's highlighting the "length of the word" because you're resetting the cell's height and width (ultimately resetting it to the length of its content). To fix this, simply remove width: auto and height: auto:

td:focus{
    border: 2px inset white;
    border-width:2px;
    content: '';
    position: absolute;
    background: white;
}

JSFiddle demo.

Upvotes: 1

Related Questions