Jump to content

w3.css - tables and a scroll bar


liverpool-phil

Recommended Posts

HI I am trying to have a table with fixed header, and scrollable data cells below. on the right hand side of the table I would like a scroll bar to allow the data cells to scroll vertically.

This is the code I'm currently trying (without success)

.pb-scroll {
	display: 	 block;
	max-height:  400px;
	overflow:	 auto;
}

<tbody class="pb-scroll">
  <tr>
    <td>
      
      etc.

Any help greatly appreciated.

Phil

Link to comment
Share on other sites

https://www.w3schools.com/code/tryit.asp?filename=G6A3A9X7PEY4

 

The problem is different browsers, different scrollbar widths, I tried this in three main browsers IE,Chrome, FF, and they are identical, if you find browser that causes misalignment because of scrollbar I suggest you re-enable 

.table-header {/*overflow-y:scroll;*/}

This will created scrollbar in header, even not required but will Make ALL browsers correctly to column widths.  

Edited by dsonesuk
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...