Which causes the scrollbar that cannot be cropped on the table side in this script: http://jsfiddle.net/m4HB3/8/ Currently it is under the last column, which means that it occupies some space of these columns and thus , causes alignment problems with the table.
The table headers are fixed, since I need a scroll table with fixed headers.
Could the problem be the width given for the table and individual columns?
Can someone please also write your response to the script outside of jsfiddle and put it directly in the browser because I saw examples where something works in jsifddle but then it doesnβt work in the main application in the browser.
HTML:
<table id="tableqanda" cellpadding="0" cellspacing="0"> <thead> <tr> <th width="5%" class="questionno">Question No.</th> <th width="27%" class="question">Question</th> <th width="7%" class="option">Option Type</th> <th width="11%" class="image">Image</th> </tr> </thead> </table> <div id="tableqanda_onthefly_container"> <table id="tableqanda_onthefly" cellpadding="0" cellspacing="0"> <tbody> <tr class="tableqandarow"> <td width="5%" class="questionno">1</td> <td width="27%" class="question">What is a RAM?</td> <td width="7%" class="option">AE</td> <td width="11%" class="imagetd"><ul class="qandaul"><li>Lighthouse_4.jpg</li></ul></td> </tr> <tr class="tableqandarow"> <td width="5%" class="questionno">2</td> <td width="27%" class="question">Name 3 car maneuvers you may do in a test?</td> <td width="7%" class="option">AF</td> <td width="11%" class="imagetd"><ul class="qandaul"><li>Tulips_3.jpg</li></ul></td> </tr> </tbody> </table> </div>
CSS
#tableqanda_onthefly_container { width:100%; overflow-y: auto; overflow-x: hidden; max-height:25px; } #tableqanda_onthefly { width:100%; overflow-y: auto; overflow-x: hidden; clear:both; } #tableqanda_onthefly td { border:1px black solid; border-collapse:collapse; } #tableqanda, #tableqanda_onthefly{ border:1px black solid; border-collapse:collapse; table-layout:fixed; word-wrap:break-word; } #tableqanda{ width:100%; margin-left:0; float:left; } #tableqanda td { vertical-align: middle; border:1px black solid; border-collapse:collapse; } #tableqanda th{ border:1px black solid; border-collapse:collapse; text-align:center; } .tableqandarow{ border:1px black solid; border-collapse:collapse; }
UPDATE:
http://jsfiddle.net/m4HB3/37/
I have a js script that works fine. But if you copy the code to standard html, the columns will not be aligned. If you can correctly align the columns with your headings with a scroll bar on the side of the table, then this would be a great answer
user1830984
source share