Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

position a <span> at the bottom of a <td> table cell

I am trying to get a <span> to sit at the bottom of a fixed-height <td>, however it does not seem to be working.

I am developing in Firefox using Firebug and this is my markup and CSS.

I have read other posts stating that the td height needs to be fixed, well I have done that, however I am still having the same problem. How can I position the span at the bottom of the td?

<td class="details_amount">
  <span class="item_total_price">
    £<span id="amount_99201100099">49</span>
  </span>
  <br>
  <span class="person_price">£5</span>
</td>

td {
    height: 55px;
    padding-top: 1.8em;
    vertical-align: top;
}

.item_total_price {
    height: 100%;
}

.person_price {
    bottom: 0;
    position: relative;
}

How it looks in Firefox

like image 563
crmpicco Avatar asked Oct 22 '25 01:10

crmpicco


1 Answers

You need position:absolute not position: relative for .person_price:

.person_price {
   position: absolute;
   bottom:0;
   left:0;
}

And also make his parent relative:

td {
  position:relative;
}
like image 134
DaniP Avatar answered Oct 24 '25 16:10

DaniP



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!