html - 将图像置于 SVG 填充之前
问题描述
我有一个 SVG 元素, dining-table
. 我想在dining-table
.
- 我需要将图像元素留在元素中,
dining-table
因为这些dining-table
元素被包裹在一个 for 循环中。 z-index
据我所知,不适用于 SVG 元素。- 为填充颜色添加不透明度不是我想要做的。
.dining-table rect {
width: 50px;
height: 50px;
fill: white;
stroke: #0A7A74;
stroke-width: 2px;
}
<svg width="500px" height="500px">
<g class="dining-table">
<image xlink:href="http://kommis.net/wp-content/uploads/2018/07/410147-200.png" x="0" y="0" height="50px" width="50px"/>
<rect>
</rect>
</g>
</svg>
这是 JSfiddle 链接:https ://jsfiddle.net/ye0atc3p/7/
解决方案
推荐阅读
- reactjs - React Native - 如何更改一个元素的颜色?
- spring-boot - oauth2-oidc-sdk ParseException:“不接受无算法”
- javascript - 如何阻止我的团队在 React 中使用原始字符串作为 JSX 子项?
- regex - 在记事本++中以n个字符完成整个单词的拆分短语
- sql - MariaDB:COUNT DISTINCT 是否被窃听?
- c# - 使用方法转义 XML 时出现 System.OutOfMemoryException
- java - 使用 jsoup 解析 londonstockexchange 页面
- java - 如何找到价格的平均值?
- css - 将导航栏定位在页面顶部但在主要内容上失去可点击性
- ruby - 查找一个项目是否在数组中的另一个项目之前