Realization Method of Adding Horizontal Scroll Bar to Table in jsp

  • 2021-10-25 07:36:56
  • OfStack

First of all, the bootstrap framework is used in this project, so some people will say that it is enough to set adaptive properties for tables

What I want to state here is that

bootsrtap Adaptation is designed for horizontal scroll bars that appear when the browser does not occupy the entire screen, but is one and a half

And when we maximize the browser, what if the number of columns increases? What effect will it have

The answer is that there will be a squeezing effect, and there will be no scroll bar horizontally

Looking at the tutorials on the Internet, many people say that it is impossible to set 100% of the parent div or add scrool attributes to table

Here, the solution is very simple, set < th > Tag, so that it does not wrap lines

$(document).ready(function() { 

To set the property that the th tag does not allow word wrapping after the page is loaded

Note that this attribute is used in css, which is different from that used in th tag. The method used in th tag is as follows

< th nowrap="nowrap" > It can also be realized without automatic line wrapping

Related articles: