Skip to content

Instantly share code, notes, and snippets.

@cgoehl
Last active August 11, 2017 20:46
Show Gist options
  • Select an option

  • Save cgoehl/a87fc66e68144a1ed0592524d0ea2574 to your computer and use it in GitHub Desktop.

Select an option

Save cgoehl/a87fc66e68144a1ed0592524d0ea2574 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html>
<head>
<title>3924</title>
<style>body { font-family: sans-serif; font-size: xx-small; }</style>
</head>
<body>
<button onclick="window.print()">Print</button>
<div>
<h3>No opacity</h3>
<svg width="14" height="14">
<g>
<rect x="1" y="1" width="12" height="12" fill="#607d8b"></rect>
<rect x="1" y="1" width="12" height="12" fill="none" stroke="black"></rect>
</g>
</svg>
</div>
<div>
<h3>On filled rect</h3>
<svg width="14" height="14">
<g>
<rect x="1" y="1" width="12" height="12" fill="#607d8b" opacity="0.5"></rect>
<rect x="1" y="1" width="12" height="12" fill="none" stroke="black"></rect>
</g>
</svg>
</div>
<div>
<h3>On stroked rect</h3>
<svg width="14" height="14">
<g>
<rect x="1" y="1" width="12" height="12" fill="#607d8b"></rect>
<rect x="1" y="1" width="12" height="12" fill="none" stroke="black" opacity="0.5"></rect>
</g>
</svg>
</div>
<div>
<h3>On single group</h3>
<svg width="14" height="14">
<g opacity="0.5">
<rect x="1" y="1" width="12" height="12" fill="#607d8b"></rect>
<rect x="1" y="1" width="12" height="12" fill="none" stroke="black"></rect>
</g>
</svg>
</div>
<div>
<h3>On single group, just fill rect</h3>
<svg width="14" height="14">
<g opacity="0.5">
<rect x="1" y="1" width="12" height="12" fill="#607d8b"></rect>
</g>
</svg>
</div>
<div>
<h3>On fill group</h3>
<svg width="14" height="14">
<g opacity="0.5"><rect x="1" y="1" width="12" height="12" fill="#607d8b"></rect></g>
<g><rect x="1" y="1" width="12" height="12" fill="none" stroke="black"></rect></g>
</svg>
</div>
<div>
<h3>On stroke group</h3>
<svg width="14" height="14">
<g><rect x="1" y="1" width="12" height="12" fill="#607d8b"></rect></g>
<g opacity="0.5"><rect x="1" y="1" width="12" height="12" fill="none" stroke="black"></rect></g>
</svg>
</div>
<div>
<h3>Overlapping svg</h3>
<div style="position: relative">
<svg width="14" height="14" style="position: absolute">
<g opacity="0.5"><rect x="1" y="1" width="12" height="12" fill="#607d8b"></rect></g>
</svg>
<svg width="14" height="14" style="position: absolute">
<rect x="1" y="1" width="12" height="12" fill="none" stroke="black"></rect>
</svg>
</div>
</div>
<div>
<h3>Overlapping svg 2</h3>
<div style="position: relative">
<svg width="14" height="14" style="position: absolute">
<g opacity="0.5">
<rect x="1" y="1" width="12" height="12" fill="#607d8b"></rect>
<rect x="1" y="1" width="12" height="12" fill="none" stroke="black"></rect>
</g>
</svg>
<svg width="14" height="14" style="position: absolute">
<rect x="1" y="1" width="12" height="12" fill="none" stroke="black"></rect>
</svg>
</div>
</div>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment