css - Fixing Table column names when table scrolls -


i'm creating table on display on jsp page in struts2. want able scroll table keep column headings fixed @ top. far can achieve when scroll table headings scroll.

here table code.

<div style="height: 150px; overflow: auto;">         <p id="contact"></p>         <table class="table table-stripec" id="contact" border="data-height=100" align = "center"  >             <thead>                 <tr>                     <th>ticket id</th>                     <th>creation date</th>                     <th>client name</th>                     <th>department.</th>                     <th>summary.</th>                     <th>assigned to.</th>                     <th>status.</th>                     <th>update.</th>                     <th>category.</th>                 </tr>                 <p></p>                  <s:iterator value="ticketlist">                     <tr>                         <td><s:property value="ticket_id" /></td>                         <td><s:property value="date1" /></td>                         <td><s:property value="name" /></td>                         <td><s:property value="department" /></td>                         <td><s:property value="issuetype" /></td>                                                <td><s:property value="assignename" /></td>                         <td><s:property value="status" /></td>                         <td><s:property value="statusupdate" /></td>                         <td><s:property value="category" /></td>                     </tr>                 </s:iterator>                </thead>         </table>     </div>  

any appreciated.

because writing rows head of table instead of body. try

<table class="table table-stripec" id="contact" border="data-height=100" align = "center"  >     <thead>         <tr>             <th>ticket id</th>             <th>creation date</th>             <th>client name</th>             <th>department.</th>             <th>summary.</th>             <th>assigned to.</th>             <th>status.</th>             <th>update.</th>             <th>category.</th>         </tr>     </thead>     <tbody>         <s:iterator value="ticketlist">             <tr>                 <td><s:property value="ticket_id" /></td>                 <td><s:property value="date1" /></td>                 <td><s:property value="name" /></td>                 <td><s:property value="department" /></td>                 <td><s:property value="issuetype" /></td>                                        <td><s:property value="assignename" /></td>                 <td><s:property value="status" /></td>                 <td><s:property value="statusupdate" /></td>                 <td><s:property value="category" /></td>             </tr>         </s:iterator>     </tbody> </table> 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -