Skip to content

Instantly share code, notes, and snippets.

@tlindsay
Created June 9, 2017 19:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tlindsay/a9a87970062c692a67e268f424d6d1bc to your computer and use it in GitHub Desktop.
Save tlindsay/a9a87970062c692a67e268f424d6d1bc to your computer and use it in GitHub Desktop.
Horizontally and Vertically Center SVGs
<style>
.wrapper {
position: relative;
svg {
bottom: 50%;
left: 50%;
position: absolute;
right: 50%;
top: 50%;
transform: translate(-50%, -50%);
}
}
</style>
<div class="wrapper">
<svg>
<!-- SVG stuff -->
</svg>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment