html - How to insert a svg into a hml table which spans over multiple rows -


i want insert svg-image in html-table should span on multiple rows of table. how do that?

here's have now:

enter image description here

but want produce this:

enter image description here

my svg-rects should span per 1 table-column on multiple rows:

here code:

<!doctype html> <html> <head> <style>  body {      position: absolute; }  svg {     stroke:rgb(0,0,0);     stroke-width:2;     border:1px solid black;     position:abolsute;     z-index:10; }  svg > rect.firstrect {     fill: rgb(234,145,234);     stroke:#006600; }  svg > rect.secondrect {     fill: rgb(123,11,234);     stroke:#006600; }  svg > rect.thirdrect {     fill: rgb(11,234,98);     stroke:#006600; }  table {     border:1px solid black;     border-collapse:collapse;     width:55%;     height:55%;     margin-top:10px;     z-index:20; }  td,th {     border:1px solid black;     padding:2px;     width:250px;     height:25px;     font-weight:bold;     text-align:center; }  td.withsvg{     position: relative; } </style> </head> <body>    <table>     <tr>         <th >23.04</th>         <th>24.04</th>         <th>profilnr</th>         <th>schnitt</th>     </tr>     <tr>         <td>03:37</td>         <td>11:35</td>         <td>19:13</td>         <td>21:46</td>     </tr>     <tr>         <td>&nbsp;</td>         <td>&nbsp;</td>         <td>&nbsp;</td>         <td>&nbsp;</td>     </tr>     <tr>         <td>&nbsp;</td>         <td>&nbsp;</td>         <td>&nbsp;</td>         <td>&nbsp;</td>     </tr>     <tr>         <td>&nbsp;</td>         <td>&nbsp;</td>         <td>&nbsp;</td>         <td>&nbsp;</td>     </tr>     <tr>         <td class='withsvg'>         <!--    <svg width="250px" height="250px">                 <rect class='firstrect' x="0" y="100" height="150" width="100%"/>                 <rect class='secondrect' x="25" y="150" height="100" width="80%"/>                 <rect class='thirdrect' x="50" y="200" height="50" width="60%"/>             </svg> -->         </td>         <td>&nbsp;</td>         <td>&nbsp;</td>         <td>&nbsp;</td>     </tr>     <tr>         <td>&nbsp;</td>         <td>&nbsp;</td>         <td>&nbsp;</td>         <td>&nbsp;</td>     </tr>         <tr>         <td>&nbsp;</td>         <td>&nbsp;</td>         <td>&nbsp;</td>         <td>&nbsp;</td>     </tr>         <tr>         <td>&nbsp;</td>         <td>&nbsp;</td>         <td>&nbsp;</td>         <td>&nbsp;</td>     </tr>   </table>   </body> </html> 

you have use <div> able interact row size.

sadly makes code more complicated have use kind of syntax :

<td class='withsvg'>       <div class="content">         <svg>             <rect class='firstrect' x="0" y="0" height="50" width="100%"/>             <rect class='secondrect' x="35" y="3" height="150" width="50%"/>             <rect class='thirdrect' x="43" y="6" height="120" width="40%"/>         </svg>       </div>     </td> 

the code same yours, added <div> around <rect>.

here example : js fiddle


Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -