亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

在表格的頂部覆蓋 SVG

在表格的頂部覆蓋 SVG

桃花長相依 2022-06-16 15:27:29
是否可以在可滾動的 tbody 頂部覆蓋 SVG 畫布?我需要在我的 trs 中的 div 之間畫線。如果可以在可滾動的 tbody 上覆蓋 SVG 畫布,則非常感謝任何示例。以下是我正在使用的表的示例,表溢出是自動的。在此示例中,我試圖在“連接 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>
查看完整描述

1 回答

?
冉冉說

TA貢獻1877條經驗 獲得超1個贊

我能夠讓它工作,我不得不去position: relative;<table>在里面<tbody>加上<svg>標簽<tbody>position: absolute; width: 100%; height: 100%;



查看完整回答
反對 回復 2022-06-16
  • 1 回答
  • 0 關注
  • 194 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號