-1

I want to fix header in bootstrap table with tbody scroll. I have search many result but not getting proper answer yet.

<table>
<thead>
<tr>
<td width='100'>Sr. No</td>
<td width='200'>Name</td>
<td width='100'>Addr</td>
</tr>
</thead>
<tbody>
<tr><td>1</td><td>Abc</td><td>Mumbai</td></tr>
<tr><td>2</td><td>Pqr</td><td>Mumbai</td></tr>
<tr><td>3</td><td>Lmn</td><td>Mumbai</td></tr>
<tr><td>4</td><td>Xyz</td><td>Mumbai</td></tr>
</tbody>
</table>
lbm gplus
  • 55
  • 6
  • 1
    Please take some time to read the help page, especially the sections named ["What topics can I ask about here?"](http://stackoverflow.com/help/on-topic), ["What types of questions should I avoid asking?"](http://stackoverflow.com/help/dont-ask), and more importantly, please read [the Stack Overflow question checklist](http://meta.stackexchange.com/q/156810/204922). You might also want to learn about [Minimal, Complete, and Verifiable Examples](http://stackoverflow.com/help/mcve). – Rory McCrossan May 15 '18 at 10:19
  • Not quite sure what you mean by "fix header" but did you mean: `` ? – freedomn-m May 15 '18 at 10:19
  • Possible duplicate of [Table header to stay fixed at the top when user scrolls it out of view with jQuery](https://stackoverflow.com/questions/4709390/table-header-to-stay-fixed-at-the-top-when-user-scrolls-it-out-of-view-with-jque) – Karthik May 15 '18 at 10:35
  • You cannot have scroll directly to table. Table doesn't allow scroll. Try searching for fixed header for table in stackoverflow. See if this solution helps [link](https://stackoverflow.com/questions/8423768/freeze-the-top-row-for-an-html-table-only-fixed-table-header-scrolling/32092987#32092987) – Tom May 15 '18 at 10:53

1 Answers1

0

.navbar {
  overflow: hidden;
  background-color: #333;
  position: fixed;
  top: 0;
  width: 100%;
}

add this class in your first TAG

Mogli
  • 1
  • 2