是否可以將 SVG 畫布覆蓋在可滾動的 tbody 之上?我需要在我的 trs 中的 div 之間畫線。如果可以將 SVG 畫布覆蓋在可滾動的 tbody 上,那么任何示例都會非常感激。以下是我正在使用的表的示例,表溢出是自動的。在此示例中,我嘗試在“連接 1”和“連接 2”之間畫一條線,并且當我向左/向右或向上/向下滾動表格時,我希望使該線保持與這兩個組件的連接。<table> <thead> <tr> <th>1 </th> <th>2 </th> <th>3 </th> </tr> </thead> <tbody> <svg style=" position: absolute; width: 100%; height: 100%; top: 0; left: 0;"> <line x1="0" y1="0" x2="200" y2="200" style="stroke:rgb(255,0,0);stroke-width:2"></line></svg> <tr style="height: 30px;"> <td style="position: absolute; left: 100px;"> <div>Connection 1 </div> </td> </tr> <tr style="height: 30px;"> <td> <div style="position: absolute; left: 200px;">Connection 2 </div> </td> </tr> <tr style="height: 30px;"> <td> <div style="position: absolute; left: 400px;">Connection 3 </div> </td> </tr> <tbody></table>
將 SVG 疊加在表格主體頂部
慕田峪7331174
2023-11-13 15:21:02