目前我有一个表格单元网格,所有表格单元格都以不同的色调和样式着色。我正在努力使样式正确拼贴,因为此刻他们从他们的单元格的左上角开始并在右下角完成,但即使他们有相同风格的邻居和颜色他们拒绝继续正常。
有没有办法解决这个问题,以便细胞能够从SVG中找到相邻细胞?我意识到我要问的可能不是很清楚,所以我创建了一个非常简单的表格,其中的样式表明了我遇到的问题。
td {
height: 25px;
width: 25px;
}
.red {
background-color: #ff0000;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='28' height='49' viewBox='0 0 28 49'%3E%3Cg fill-rule='evenodd'%3E%3Cg id='hexagons' fill='%23000000' fill-opacity='0.47' fill-rule='nonzero'%3E%3Cpath d='M13.99 9.25l13 7.5v15l-13 7.5L1 31.75v-15l12.99-7.5zM3 17.9v12.7l10.99 6.34 11-6.35V17.9l-11-6.34L3 17.9zM0 15l12.98-7.5V0h-2v6.35L0 12.69v2.3zm0 18.5L12.98 41v8h-2v-6.85L0 35.81v-2.3zM15 0v7.5L27.99 15H28v-2.31h-.01L17 6.35V0h-2zm0 49v-8l12.99-7.5H28v2.31h-.01L17 42.15V49h-2z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.blue {
background-color: #505090;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='152' height='152' viewBox='0 0 152 152'%3E%3Cg fill-rule='evenodd'%3E%3Cg id='temple' fill='%23000000' fill-opacity='0.47'%3E%3Cpath d='M152 150v2H0v-2h28v-8H8v-20H0v-2h8V80h42v20h20v42H30v8h90v-8H80v-42h20V80h42v40h8V30h-8v40h-42V50H80V8h40V0h2v8h20v20h8V0h2v150zm-2 0v-28h-8v20h-20v8h28zM82 30v18h18V30H82zm20 18h20v20h18V30h-20V10H82v18h20v20zm0 2v18h18V50h-18zm20-22h18V10h-18v18zm-54 92v-18H50v18h18zm-20-18H28V82H10v38h20v20h38v-18H48v-20zm0-2V82H30v18h18zm-20 22H10v18h18v-18zm54 0v18h38v-20h20V82h-18v20h-20v20H82zm18-20H82v18h18v-18zm2-2h18V82h-18v18zm20 40v-18h18v18h-18zM30 0h-2v8H8v20H0v2h8v40h42V50h20V8H30V0zm20 48h18V30H50v18zm18-20H48v20H28v20H10V30h20V10h38v18zM30 50h18v18H30V50zm-2-40H10v18h18V10z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.green {
background-color: #00ff00;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='88' height='24' viewBox='0 0 88 24'%3E%3Cg fill-rule='evenodd'%3E%3Cg id='autumn' fill='%23000000' fill-opacity='0.47'%3E%3Cpath d='M10 0l30 15 2 1V2.18A10 10 0 0 0 41.76 0H39.7a8 8 0 0 1 .3 2.18v10.58L14.47 0H10zm31.76 24a10 10 0 0 0-5.29-6.76L4 1 2 0v13.82a10 10 0 0 0 5.53 8.94L10 24h4.47l-6.05-3.02A8 8 0 0 1 4 13.82V3.24l31.58 15.78A8 8 0 0 1 39.7 24h2.06zM78 24l2.47-1.24A10 10 0 0 0 86 13.82V0l-2 1-32.47 16.24A10 10 0 0 0 46.24 24h2.06a8 8 0 0 1 4.12-4.98L84 3.24v10.58a8 8 0 0 1-4.42 7.16L73.53 24H78zm0-24L48 15l-2 1V2.18A10 10 0 0 1 46.24 0h2.06a8 8 0 0 0-.3 2.18v10.58L73.53 0H78z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.pink {
background-color: pink;
background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cg fill='%23000000' fill-opacity='0.47'%3E%3Cpolygon fill-rule='evenodd' points='8 4 12 6 8 8 6 12 4 8 0 6 4 4 6 0 8 4'/%3E%3C/g%3E%3C/svg%3E");
}
<body>
<table>
<tbody><tr>
<td class="green"></td>
<td class="red"></td>
<td class="blue"></td>
<td class="red"></td>
<td class="pink"></td>
<td class="green"></td>
<td class="red"></td>
<td class="red"></td>
<td class="green"></td>
<td class="green"></td>
<td class="blue"></td>
<td class="pink"></td>
<td class="green"></td>
<td class="red"></td>
<td class="pink"></td>
<td class="blue"></td>
<td class="green"></td>
<td class="blue"></td>
<td class="red"></td>
<td class="pink"></td>
</tr>
<tr>
<td class="pink"></td>
<td class="pink"></td>
<td class="green"></td>
<td class="blue"></td>
<td class="blue"></td>
<td class="red"></td>
<td class="green"></td>
<td class="red"></td>
<td class="pink"></td>
<td class="red"></td>
<td class="red"></td>
<td class="blue"></td>
<td class="green"></td>
<td class="red"></td>
<td class="red"></td>
<td class="red"></td>
<td class="blue"></td>
<td class="blue"></td>
<td class="red"></td>
<td class="green"></td>
</tr>
<tr>
<td class="pink"></td>
<td class="blue"></td>
<td class="red"></td>
<td class="red"></td>
<td class="red"></td>
<td class="green"></td>
<td class="red"></td>
<td class="red"></td>
<td class="red"></td>
<td class="red"></td>
<td class="green"></td>
<td class="green"></td>
<td class="green"></td>
<td class="blue"></td>
<td class="blue"></td>
<td class="pink"></td>
<td class="pink"></td>
<td class="blue"></td>
<td class="red"></td>
<td class="red"></td>
</tr>
<tr>
<td class="blue"></td>
<td class="green"></td>
<td class="blue"></td>
<td class="blue"></td>
<td class="green"></td>
<td class="green"></td>
<td class="green"></td>
<td class="red"></td>
<td class="red"></td>
<td class="green"></td>
<td class="pink"></td>
<td class="red"></td>
<td class="blue"></td>
<td class="blue"></td>
<td class="red"></td>
<td class="red"></td>
<td class="pink"></td>
<td class="red"></td>
<td class="red"></td>
<td class="blue"></td>
</tr>
<tr>
<td class="red"></td>
<td class="red"></td>
<td class="blue"></td>
<td class="green"></td>
<td class="red"></td>
<td class="pink"></td>
<td class="green"></td>
<td class="blue"></td>
<td class="red"></td>
<td class="green"></td>
<td class="pink"></td>
<td class="red"></td>
<td class="red"></td>
<td class="pink"></td>
<td class="pink"></td>
<td class="red"></td>
<td class="red"></td>
<td class="blue"></td>
<td class="red"></td>
<td class="pink"></td>
</tr>
<tr>
<td class="blue"></td>
<td class="red"></td>
<td class="green"></td>
<td class="red"></td>
<td class="red"></td>
<td class="red"></td>
<td class="blue"></td>
<td class="blue"></td>
<td class="pink"></td>
<td class="red"></td>
<td class="red"></td>
<td class="red"></td>
<td class="green"></td>
<td class="green"></td>
<td class="pink"></td>
<td class="red"></td>
<td class="red"></td>
<td class="red"></td>
<td class="green"></td>
<td class="red"></td>
</tr>
<tr>
<td class="green"></td>
<td class="pink"></td>
<td class="red"></td>
<td class="red"></td>
<td class="green"></td>
<td class="red"></td>
<td class="pink"></td>
<td class="pink"></td>
<td class="red"></td>
<td class="pink"></td>
<td class="blue"></td>
<td class="red"></td>
<td class="red"></td>
<td class="pink"></td>
<td class="blue"></td>
<td class="green"></td>
<td class="green"></td>
<td class="red"></td>
<td class="red"></td>
<td class="pink"></td>
</tr>
<tr>
<td class="blue"></td>
<td class="blue"></td>
<td class="red"></td>
<td class="blue"></td>
<td class="blue"></td>
<td class="blue"></td>
<td class="blue"></td>
<td class="red"></td>
<td class="blue"></td>
<td class="pink"></td>
<td class="green"></td>
<td class="red"></td>
<td class="blue"></td>
<td class="pink"></td>
<td class="red"></td>
<td class="blue"></td>
<td class="green"></td>
<td class="red"></td>
<td class="green"></td>
<td class="pink"></td>
</tr>
<tr>
<td class="red"></td>
<td class="green"></td>
<td class="red"></td>
<td class="red"></td>
<td class="pink"></td>
<td class="red"></td>
<td class="blue"></td>
<td class="red"></td>
<td class="green"></td>
<td class="red"></td>
<td class="green"></td>
<td class="red"></td>
<td class="red"></td>
<td class="blue"></td>
<td class="red"></td>
<td class="red"></td>
<td class="red"></td>
<td class="red"></td>
<td class="green"></td>
<td class="red"></td>
</tr>
<tr>
<td class="green"></td>
<td class="green"></td>
<td class="green"></td>
<td class="pink"></td>
<td class="blue"></td>
<td class="blue"></td>
<td class="green"></td>
<td class="red"></td>
<td class="green"></td>
<td class="red"></td>
<td class="pink"></td>
<td class="red"></td>
<td class="red"></td>
<td class="pink"></td>
<td class="blue"></td>
<td class="red"></td>
<td class="pink"></td>
<td class="red"></td>
<td class="green"></td>
<td class="red"></td>
</tr>
<tr>
<td class="blue"></td>
<td class="red"></td>
<td class="red"></td>
<td class="red"></td>
<td class="pink"></td>
<td class="blue"></td>
<td class="red"></td>
<td class="red"></td>
<td class="blue"></td>
<td class="pink"></td>
<td class="blue"></td>
<td class="pink"></td>
<td class="red"></td>
<td class="red"></td>
<td class="red"></td>
<td class="red"></td>
<td class="red"></td>
<td class="pink"></td>
<td class="red"></td>
<td class="green"></td>
</tr>
<tr>
<td class="red"></td>
<td class="red"></td>
<td class="blue"></td>
<td class="green"></td>
<td class="pink"></td>
<td class="blue"></td>
<td class="blue"></td>
<td class="pink"></td>
<td class="green"></td>
<td class="green"></td>
<td class="blue"></td>
<td class="green"></td>
<td class="pink"></td>
<td class="green"></td>
<td class="blue"></td>
<td class="blue"></td>
<td class="pink"></td>
<td class="red"></td>
<td class="green"></td>
<td class="blue"></td>
</tr>
<tr>
<td class="blue"></td>
<td class="red"></td>
<td class="red"></td>
<td class="red"></td>
<td class="red"></td>
<td class="pink"></td>
<td class="blue"></td>
<td class="pink"></td>
<td class="blue"></td>
<td class="red"></td>
<td class="green"></td>
<td class="red"></td>
<td class="blue"></td>
<td class="blue"></td>
<td class="red"></td>
<td class="green"></td>
<td class="pink"></td>
<td class="pink"></td>
<td class="red"></td>
<td class="red"></td>
</tr>
<tr>
<td class="pink"></td>
<td class="red"></td>
<td class="red"></td>
<td class="pink"></td>
<td class="blue"></td>
<td class="pink"></td>
<td class="red"></td>
<td class="red"></td>
<td class="blue"></td>
<td class="blue"></td>
<td class="blue"></td>
<td class="pink"></td>
<td class="red"></td>
<td class="red"></td>
<td class="blue"></td>
<td class="red"></td>
<td class="red"></td>
<td class="pink"></td>
<td class="red"></td>
<td class="red"></td>
</tr>
<tr>
<td class="green"></td>
<td class="red"></td>
<td class="pink"></td>
<td class="red"></td>
<td class="red"></td>
<td class="red"></td>
<td class="red"></td>
<td class="red"></td>
<td class="red"></td>
<td class="green"></td>
<td class="red"></td>
<td class="blue"></td>
<td class="red"></td>
<td class="red"></td>
<td class="green"></td>
<td class="red"></td>
<td class="green"></td>
<td class="green"></td>
<td class="green"></td>
<td class="blue"></td>
</tr>
<tr>
<td class="pink"></td>
<td class="red"></td>
<td class="red"></td>
<td class="red"></td>
<td class="green"></td>
<td class="red"></td>
<td class="pink"></td>
<td class="pink"></td>
<td class="red"></td>
<td class="green"></td>
<td class="green"></td>
<td class="pink"></td>
<td class="red"></td>
<td class="green"></td>
<td class="blue"></td>
<td class="green"></td>
<td class="red"></td>
<td class="green"></td>
<td class="red"></td>
<td class="red"></td>
</tr>
<tr>
<td class="red"></td>
<td class="pink"></td>
<td class="pink"></td>
<td class="green"></td>
<td class="pink"></td>
<td class="pink"></td>
<td class="blue"></td>
<td class="green"></td>
<td class="red"></td>
<td class="blue"></td>
<td class="green"></td>
<td class="pink"></td>
<td class="green"></td>
<td class="green"></td>
<td class="green"></td>
<td class="red"></td>
<td class="green"></td>
<td class="red"></td>
<td class="blue"></td>
<td class="blue"></td>
</tr>
<tr>
<td class="red"></td>
<td class="pink"></td>
<td class="red"></td>
<td class="blue"></td>
<td class="red"></td>
<td class="green"></td>
<td class="green"></td>
<td class="red"></td>
<td class="red"></td>
<td class="pink"></td>
<td class="red"></td>
<td class="pink"></td>
<td class="blue"></td>
<td class="blue"></td>
<td class="blue"></td>
<td class="red"></td>
<td class="red"></td>
<td class="red"></td>
<td class="red"></td>
<td class="green"></td>
</tr>
<tr>
<td class="green"></td>
<td class="pink"></td>
<td class="pink"></td>
<td class="blue"></td>
<td class="red"></td>
<td class="red"></td>
<td class="red"></td>
<td class="pink"></td>
<td class="red"></td>
<td class="green"></td>
<td class="green"></td>
<td class="green"></td>
<td class="pink"></td>
<td class="green"></td>
<td class="green"></td>
<td class="red"></td>
<td class="red"></td>
<td class="pink"></td>
<td class="green"></td>
<td class="blue"></td>
</tr>
<tr>
<td class="blue"></td>
<td class="pink"></td>
<td class="green"></td>
<td class="red"></td>
<td class="blue"></td>
<td class="red"></td>
<td class="pink"></td>
<td class="red"></td>
<td class="green"></td>
<td class="green"></td>
<td class="red"></td>
<td class="green"></td>
<td class="pink"></td>
<td class="green"></td>
<td class="red"></td>
<td class="red"></td>
<td class="blue"></td>
<td class="red"></td>
<td class="red"></td>
<td class="green"></td>
</tr>
</tbody></table>
</body>
答案 0 :(得分:1)
如果您愿意在SVG中绘制整个表格,这很容易 - 图案元素的图案可以相对于绘图表面而不是填充元素固定,因此&#34;平铺&#34;是微不足道的。
还有一种过于精细的方式通过过滤器对整个桌子进行平铺 - 但我不推荐它。