简体   繁体   English

在可通过 overflow-x 滚动的 html css 角度表中,有没有办法修复最右边的列?

[英]In a html css angular table that is scrollable through overflow-x, is there a way to fix the right-most column?

In a html css angular table that is scrollable through overflow-x, is there a way to fix the right-most column so that when i scroll from left to right, that column stays there?在可通过 overflow-x 滚动的 html css 角度表中,有没有办法修复最右边的列,以便当我从左向右滚动时,该列保留在那里?

I tried the sticky property, as well as creating two tables right next to eachother (which does not accomplish the task successfully. I am thinking that i should overlay two tables on top of eachother but i am not sure how i should go about this.我尝试了粘性属性,并在彼此旁边创建了两个表(这没有成功完成任务。我在想我应该将两个表叠加在彼此之上,但我不确定我应该如何去做。

position: sticky appears to work fine on chrome and firefox: position: sticky似乎在 chrome 和 firefox 上运行良好:

 div { width: 100%; overflow: hidden; overflow-x: scroll; } table, th, td { border: 1px solid black; background-color: white; } table { width: 1000px; }.sticky-col { width: 40px; position: sticky; right: 0; }
 <div> <table> <tr><th>1</th><th>2</th><th class="sticky-col">3</th></tr> <tr><td>1,1</td><td>1,2</td><td class="sticky-col">1,3</td></tr> <tr><td>2,1</td><td>2,2</td><td class="sticky-col">2,3</td></tr> <tr><td>3,1</td><td>3,2</td><td class="sticky-col">3,3</td></tr> </table> </div>

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

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