javascript - Controlling table-row height based on <td> which gets its height from text -
i have table contains rows 2 columns. 1 column contains images, , other contains text. images big images resize (meaning, take height container). need row take height textcell. amount of text variable in row, can't assign explicit height. considering images larger size of text, row takes height imagecell rather textcell. how row , imagecell take height of textcell?
<table border="0" cellspacing="0" cellpadding="0" id="articletable"> <tr id="row-1" class="articlerow light" > <td class="imagecell" id="image-cell-1"> <img src="images/support/cfd.png" alt="" class=""/> <img src="images/support/cfd3.png" alt="" class="" /> </td> <td class="textcell" id="text-cell-1" > <div class="articletextwrapper"> text text text text text text text text text text </div> </td> </tr> <tr id="row-2" class="articlerow dark" style=""> <td class="textcell" id="text-cell-2" > <div class="articletextwrapper"> text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text </div> </td> <td class="imagecell" id="image-cell-2"> <img src="images/support/tm2.png" alt="" class="" /> <img src="images/support/tm1.png" alt="" class=""/> </td> </tr>
maybe javascript method one:
var txts = document.getelementsbyclassname("textcell"); for(var i=0; i<txts.length; i++) { var h = txts[i].getelementsbyclassname("articletextwrapper")[0].offsetheight; txts[i].parentnode.style.height = h + "px"; }
this set fixed height <tr>
relative height of text within cell, giving ability set image total height.
javascript jquery html css internet-explorer-8
No comments:
Post a Comment