Skip to content

Instantly share code, notes, and snippets.

@DanCouper
Created April 8, 2015 14:58
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save DanCouper/29c701e543763eb08dbb to your computer and use it in GitHub Desktop.
Save DanCouper/29c701e543763eb08dbb to your computer and use it in GitHub Desktop.
Use of SVG pattern to create a PS-like transparency grid
<!-- http://mike.eire.ca/2010/02/25/easy-svg-grid/ -->
<!-- "I needed a grid in the background while I was debugging an SVG image I was creating, something like Photoshop’s transparency grid. Here’s what I did." -->
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="200" height="400">
<defs>
<pattern id="grid" width="20" height="20" patternUnits="userSpaceOnUse">
<rect fill="black" x="0" y="0" width="10" height="10" opacity="0.1"/>
<rect fill="white" x="10" y="0" width="10" height="10"/>
<rect fill="black" x="10" y="10" width="10" height="10" opacity="0.1"/>
<rect fill="white" x="0" y="10" width="10" height="10"/>
</pattern>
</defs>
<rect fill="url(#grid)" x="0" y="0" width="100%" height="100%"/>
</svg>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment