Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR HTML

html table fixed first column

<!-- just saying dont put css in your dom :) -->
<div style='height: 100px; overflow-y: scroll'>
  <table>
    <tr style='position: sticky; top: 2px'>
      <th>Name</th>
      <th>Age</th>
      <th>Job</th>
    </tr>
    <tr>
      <td>John</td>
      <td>25</td>
      <td>Programmer</td>
    </tr>
    <tr>
      <td>Jane</td>
      <td>32</td>
      <td>Designer</td>
    </tr>
    <tr>
      <td>Joe</td>
      <td>22</td>
      <td>Manager</td>
    </tr>
    <tr>
      <td>Jill</td>
      <td>30</td>
      <td>Marketing</td>
    </tr>
    <tr>
      <td>Jack</td>
      <td>40</td>
      <td>Sales</td>
    </tr>
    <tr>
      <td>Jill</td>
      <td>30</td>
      <td>Marketing</td>
    </tr>
  </table>
</div>
 
PREVIOUS NEXT
Tagged: #html #table #fixed #column
ADD COMMENT
Topic
Name
1+5 =