Make TBODY scrollable in Webkit browsers

后端 未结 14 1951
闹比i
闹比i 2020-11-29 20:33

I\'m aware of this question, but none of the answers work in Safari, Chrome, etc.

The accepted strategy (as demonstrated here) is to set the tbody height and overflo

14条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-29 20:38

    I developed javascript solution for the above problem
    which works only in Firefox 7+ as i have tested only in FF

    I came to this thread and found solution pointed by Michael Koper

    In this solution three important things are done
    1) fix the column width
    2) thead > tr display is set to block
    3) tbody display is set to block

    as others have mentioned there problem to fix the width , i am also in same position;
    even i cant fix the width statically

    so i thought i will fix the width dynamically ( after table is rendered in browser) and this did the trick :)

    following is the solution in javascript which works only in FF
    ( i have tested only in FF , i dont have access to other browsers )

           function test1(){                
                var tbodys = document.getElementsByTagName("TBODY");
                for(var i=0;i

    This solutions finds out what is the width of column from browser
    and set again the same width to columns ( header and first row of tbody )
    after the width is set; thead > tr and tbody display is set to block

    Hope this solution is useful for all of you ..
    if you can extend it to other browsers please reply to this post

提交回复
热议问题