Skip to content

Instantly share code, notes, and snippets.

@azunyuuuuuuu
Last active December 13, 2021 20:21
Show Gist options
  • Select an option

  • Save azunyuuuuuuu/5fc3d6bc4ec19a0546b57d273eaf1a57 to your computer and use it in GitHub Desktop.

Select an option

Save azunyuuuuuuu/5fc3d6bc4ec19a0546b57d273eaf1a57 to your computer and use it in GitHub Desktop.
another svg test but as pattern
{
"scripts": [
"https://cdn.tailwindcss.com"
],
"styles": []
}
<svg width="100%" height="100%">
<!-- Let's define the pattern -->
<!-- The width and height should be double the size of a single checker -->
<pattern id="pattern-checkers" x="0" y="0" width="100" height="100" patternUnits="userSpaceOnUse" >
<!-- Two instances of the same checker, only positioned apart on the `x` and `y` axis -->
<!-- We will define the `fill` in the CSS for flexible use -->
<rect class="checker bg-red-300" x="0" width="50" height="50" y="0"/>
<rect class="checker bg-blue-300" x="50" width="50" height="50" y="50"/>
<rect />
</pattern>
<!-- Define the shape that will contain our pattern as the fill -->
<rect x="0" y="0" width="100%" height="100%" fill="url(#pattern-checkers)" />
</svg>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment