1

JSFiddle

When you hover over an input field in the table, the entire cell turns grey except for a few pixels at the top. Why is that? I've tried setting everything I can think of (margin, padding, box-shadow, etc) to 0 or none, but to no avail.

2
  • 3
    td { line-height: 100% }. the size of the text in the input doesn't match the height of the table cell. setting line-height: 100% on the cell itself fixes that Commented Jun 8, 2015 at 20:47
  • @MarcB: best solution! Voting up. Regards. Commented Jun 8, 2015 at 21:00

2 Answers 2

1

You've not defined a height on the Input field, therefore it's smaller than the containing td

td input {
     height:20px;
}

http://jsfiddle.net/oe2ofup6/2/

Sign up to request clarification or add additional context in comments.

Comments

1

Consider changing your CSS to check for td:hover instead of input:hover.

Instead of:

td input:hover {
    background-color: #8d8d8d;
}

td input {
    width: 100%;
    border: 0;
}

try:

td input {
    width: 100%;
    border: 0;
}

td:hover, td:hover input {
    background-color: #8d8d8d;
}

JSFiddle

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.