简体   繁体   English

滚动只显示部分元素

[英]Scroll only showing part of the element

so am trying to make a table have a fixed size and horizontally scrollable, and I added overflow-x: auto;所以我试图让一个表有一个固定的大小和水平滚动,我添加了overflow-x: auto; , but for some reason it only scrolling part of the table while the start of the table is outside of the screen, I am unable to show the code so here is a sample to make it clearer , 但由于某种原因它只滚动表格的一部分而表格的开头在屏幕之外,我无法显示代码所以这里是一个示例以使其更清晰在此处输入图像描述

the green part can be scrolled normally but the scrollbar end it the red part, when I zoom out or add margin it appears, but that is not really a solution.绿色部分可以正常滚动,但滚动条结束红色部分,当我缩小或添加边距时,它会出现,但这并不是真正的解决方案。 The table is inside a flex container if that matters, but does not have anything applied on it.如果重要的话,该表位于一个 flex 容器内,但没有应用任何内容。
thanks谢谢

try overflow-x: scroll;尝试overflow-x: scroll; instead of overflow-x: auto;而不是overflow-x: auto;

So, I will try to guess your code as you could not share with some assumption and provides some steps may help:因此,我将尝试猜测您的代码,因为您无法与某些假设共享,并提供一些步骤可能会有所帮助:

  • try to get your table outside and test if the issue still there!!试着把你的桌子放在外面,测试问题是否仍然存在!! if yes your issue is mainly with your table style如果是,您的问题主要在于您的表格样式
  • if no, try to change the flow of FLEX container to be column and check if fixed.如果不是,请尝试将 FLEX 容器的流量更改为列并检查是否已修复。
  • if still try to add min to div containing your table inside the flex container如果仍然尝试将 min 添加到包含 flex 容器内的表的 div

otherwise, you should provide a small sample of your code to sort out the issue more clearly.否则,您应该提供一小部分代码示例,以便更清楚地解决问题。

  • remove justify-content: center on your div if you have one.删除justify-content: center on your div 如果你有一个。 i was having the same problem,then i found out that having justify-content: center on the div was the one causing the issue.我遇到了同样的问题,然后我发现有justify-content: center在 div 上是导致问题的原因。

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

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