Skip to content

Instantly share code, notes, and snippets.

@jquery404
Created October 18, 2018 04:44
Show Gist options
  • Save jquery404/5c9ce64f7d1a08c2f26aa452c46563aa to your computer and use it in GitHub Desktop.
Save jquery404/5c9ce64f7d1a08c2f26aa452c46563aa to your computer and use it in GitHub Desktop.
get circular image for any size of picture
<style>
.circular {
width: 150px;
height: 150px;
border-radius: 50%;
position: relative;
overflow: hidden;
margin: 0 auto;
}
.circular img {
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
position: absolute;
left: 50%;
top: 50%;
-webkit-transform: translate(-50%, -50%);
-moz-transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
</style>
<div class="circular">
<img src="image_url" />
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment