Reputation: 2941
In my table, I would like to keep all rows' height even and so I am setting td height with the following jQuery script
$(document).ready(function() {
$(".striped tr").css("min-width", "540px").css("padding-left", "5px");
$(".striped tr:odd").css("background-color", "#EDEDED");
$(".striped").css("font-size", "13px");
$(".striped td").css("min-height", "26px").css("vertical-align", "middle").css("display", "block");
});
Page looked like this before the script is applied:
after script is applied:
Where is the mistake?
Upvotes: 0
Views: 3400
Reputation: 34855
Remove css("display", "block")
It's causing the td
elements to be block level and to be bumped under each other.
Upvotes: 1
Reputation: 887215
Table cells have display: table-cell
.
Setting display: block
causes them to be treated as normal elements, not table cells.
Upvotes: 1