css - Match height of absolute td -


i trying setup frozen column , problem left have solve heights of other td's on same row not expand match height of absolute positioned td. since text in frozen header arbitrary, span multiple lines. if weren't absolute positioned force other td's in same row assume larger height, behavior like. since first td absolute, heights no longer linked other td's in same row.

how force other td's in same row assume larger height of first td?

http://jsfiddle.net/2wrms/5/

table {     border-collapse: separate;      width: 100%;     table-layout:fixed; } td {     margin:0;              } div.pivot-container {     width: calc(100% - 125px);     overflow-x:scroll;     margin-left:125px;     overflow-y:visible; } .headcol {     position:absolute;     width:125px;     left:20px; /*must match padding of outer element*/     top:auto; } .long {                 width: 230px;     vertical-align:top; }  <div style="padding-left:20px;"> <div class="pivot-container">     <table>         <tr>             <td class="headcol"> kjgh kj ghkj ghkj gkj g2jhfgjhfg</td>             <td class="long">qwertjklzxcvbnm</td>             <td class="long">qwertyuiofghjklzxcvbnm</td>             <td class="long">qwertyuvbnm</td>             <td class="long">qwertycvbnm</td>         </tr>         <tr>             <td class="headcol">5765765785</td>             <td class="long">qwertyuiopxcvbnm</td>             <td class="long">qwertycvbnm</td>             <td class="long">qwertycvbnm</td>             <td class="long">qwertyuiopasdnm</td>         </tr>     </table> </div> </div> 

you want other rows have same height cells in first column, right? if understood correctly, need establish width of whole table using jquery, height change want too.

if want, instance, rows no taller 26px (the height of cells in first column), table's width can changed match limit iterating through rows , checking height of each, , changing width accordingly, since indicating in css rows should x height not work.

$(window).load(function() {     var cont = 0;     var control = false;     var wtable = $("table").width();     {         cont = 0;         $("tr").each(function() {             h = $(this).height();             if(h > 26) {                 cont++;                 if(cont == 1) {                     return false;                 }             }         });         if(cont == 0) {             control = true;         }         else {             wtable = wtable + 200;             $("table").width(wtable);         }     } while(!control);     $("tr").height(26); }); 

this way, we're telling table add 200px width every row finds taller 26px, , once there no more, stop. @ end of loop establish height 1 more time in case rows ended being shorter first column.

you can see example here, uses bit of original code (i'd recommend testing directly in browser, however, since due jsfiddle's layout not display correctly). hope helps.


Comments

Popular posts from this blog

visual studio - vb.net filter binding source by time -

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -