2

I have a little bit complicated table which looks like this

<tr class='row-eq-height'>
<td><img/><div with text></td>
<td><img/><div with text></td>
<td><img/><div with text></td>
</tr>

But images have different size so i added max-width: 300px to them. And now it looks like

image      | image
text       | different text
some space | different space

So I want to stick my div with text to the bottom. I've already tried vertical align but it doesn't help at all. Finally table should look like that

image      | image
some space | different space
text       | different text

jsfiddle example

desu
  • 455
  • 2
  • 18

2 Answers2

1

Working example http://jsfiddle.net/yg0Lhhju/1/

.parent {
    display: table;
    table-layout: fixed;
}

.child {
    display:table-cell;
    vertical-align:middle;
    text-align:center;
}
Bhupinder kumar
  • 558
  • 1
  • 5
  • 19
1

You can use flexbox and set display: flex on tr to make each td equal height and justify-content: space-between with flex-direction: column on td to position image on top and text on bottom.

tr {
  display: flex;
}
td {
  max-width: 300px;
  border: 1px solid black;
  display: inline-flex;
  flex-direction: column;
  justify-content: space-between;
}
<table>
  <tr class='row-eq-height'>
  <td><img src="http://placehold.it/150x150"><div>Lorem ipsum dolor sit amet.</div></td>
  <td><img src="http://placehold.it/150x150"><div>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Porro praesentium repudiandae odit sint iure deleniti!</div></td>
  </tr>
</table>
Nenad Vracar
  • 118,580
  • 15
  • 151
  • 176