我要同时用svg线,svg圆或两者同时填充表格。问题是当我用线+圆填充单元格时,该线在圆下方而不是顶部。那我该如何解决呢?
<td height="20" width="20" align="center" valign="center" class="col3 row6">
<svg height="18" width="18">
<circle cx="9" cy="9" r="6" fill="red"></circle>
</svg>
<svg height="20" width="20">
<line x1="0" y1="9" x2="20" y2="9" style="stroke:red;stroke-width:5"></line>
</svg>
</td>
您可以绝对定位svg标签,并将它们放置在彼此的顶部。
例如:
td {
position: relative;
}
td svg {
position: absolute;
top: 0;
left: 0;
}
svg.circle {
left: 1px;
}
<table>
<td height="20" width="20" align="center" valign="center" class="col3 row6">
<svg class="circle" height="18" width="18">
<circle cx="9" cy="9" r="6" fill="red"></circle>
</svg>
<svg class="line" height="20" width="20">
<line x1="0" y1="9" x2="20" y2="9" style="stroke:red;stroke-width:5"></line>
</svg>
</td>
</table>
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句