2017-02-20 12 views
1

現時点では、私はテーブルセルのグリッドを持っています。これらのセルはすべて、さまざまな色合いとスタイルで色付けされています。私はスタイルを正確にタイルにしようとしています。現時点では、彼らはセルの左上から始まって右下で終わりますが、同じスタイルの隣人があっても、彼らは同じように続けることを拒否します。&正常。テーブルのセル内で背景SVGをタイル化するにはどうすればよいですか?

これを修正して、セルを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>

答えて

1

あなたはSVGでテーブル全体を描くために喜んでいる場合は、これは非常に簡単です - パターン要素のパターンを描画面ではなく、満たされた要素に対して固定することができますので、 「タイリング」は簡単です。

フィルタを介してテーブル全体をタイリングする方法もありますが、お勧めしません。

関連する問題