简体   繁体   English

Safari浏览器中表格的滚动条问题

[英]Scroll bar issue with tables in Safari browser

I have encountered a problem with Safari browser in displaying the scroll bar inside a table. 我在表中显示滚动条时遇到Safari浏览器问题。

The main issue is that I have defined a table with fixed height and also a overflow in CSS so that if the content exceeds the limits the scroll bar comes in action. 主要问题是,我定义了一个具有固定高度的表,并且CSS中也有一个溢出,因此,如果内容超出限制,滚动条就会生效。 I have found that it works well with Mozilla Firefox and all other browsers. 我发现它可以与Mozilla Firefox和所有其他浏览器一起很好地工作。 But when it comes to safari the vertical scroll bar is not displaying even if the content exceeds the limit of the table? 但是,关于野生动物园,即使内容超出表格的限制,垂直滚动条也不会显示? The table has 10 column, the width of each column can be controlled individually using CSS. 该表有10列,每列的宽度可以使用CSS单独控制。

Can anyone help? 有人可以帮忙吗?

I used the below code. 我用下面的代码。

CSS Code for column 1 and 2 like wise 10 different columns are there. 第1列和第2列的CSS代码类似10个不同的列。

th {
  background-color:#999999;
  color: #FFFFFF;
  width:99px;  
}   
th + th  {
  background-color:#999999; 
  color: #FFFFFF;    
  width:182px; 
}

Table body over flow code 表主体超过流代码

tbody {
  height: 300px;
  overflow-y: scroll; 
}     

AFAIK overflow(-y) on table elements doesn't work everywhere. 表元素的AFAIK溢出(-y)并非在所有地方都有效。 To be honest I'm not even sure if doing so is conform spec. 老实说,我什至不确定这样做是否符合规范。 You might want to consider using Javascript to solve this problem , as the worst thing that could happen is that someone without Javascript (on) will simply see a normal, non-scrollable table. 您可能要考虑使用Javascript解决此问题 ,因为可能发生的最糟糕的事情是,没有Javascript(on)的人只会看到一个普通的,不可滚动的表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM