Karolis
Karolis

Reputation: 137

CSS text positioning in table row

I have little problem positioning text in the middle of table row.

enter image description here

Each table row contains three <td> elements. I want to position text in the middle of the cell. Now 'Name' text where 'Description' is longer is in top. I tired

td {
  vertical-align: middle;
}

but that doesn't work. How to correctly position text?

UPDATE
This worked fine:

.table tbody>tr>td.vert-align{
    vertical-align: middle;
}

Upvotes: 2

Views: 1751

Answers (1)

Chris
Chris

Reputation: 113

Another great option that I find the most compliant is using the line-height property to vertically align/center single line text

td {
  line-height: 100px; /*play around with this value*/
}

Upvotes: 2

Related Questions