Created
October 18, 2018 04:44
-
-
Save jquery404/5c9ce64f7d1a08c2f26aa452c46563aa to your computer and use it in GitHub Desktop.
get circular image for any size of picture
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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