Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Make <textarea> fill table cell's height

I use the following code to create a table with an image and a <textare>:

<table border="1" style="border-color: #a6a6a6" cellpadding="4" cellspacing="0" width="702">\
  <col width="455">
  <col width="230">\
  <tbody>
    <tr>\
      <td type="image" id="' + sdfsdsdf + '" data-parent-id="0" data-type="NORMAL" data-img="1" data-flags="1" data-type-ios="3" height="85" width="455"><img src="http://www.whichcitytotravel.com/wp-content/uploads/2016/01/Sunset-in-Monaco.jpg" style="width:100%;"></td>\
      <td width="230">
        <pre><textarea id="' + sdfsdfsdaf + '" data-parent-id="' + id_picture + '" data-type="sdfsdafsd" data-type-ios="4" rows="5" style="width:100%; height:100%; display:block;"></textarea></pre><br></td>\
    </tr>
  </tbody>
</table>'

The result looks like this: https://jsfiddle.net/705buxgz/

I'd like the <textarea> to fill all the height available inside the cell of the table.

I tried all the other answers here and none of them worked for me.

like image 463
Richard Topchii Avatar asked May 28 '26 13:05

Richard Topchii


1 Answers

This should do the trick: https://jsfiddle.net/cLro4q10/

You have to set the table and pre height. In this case I made it 100%. A child can only be 100% height of its parent if the parents' height has been set.

like image 115
DenseCrab Avatar answered May 31 '26 05:05

DenseCrab



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!