html - make rectangular image appear circular with CSS without making pictures look out of shape -
each post on page has picture , want make rectangular image appear circular, doing code below effect, image looks out of shape: can fix this?
#circular img { width: 280px; height: 300px; border-radius: 150px; margin:35px; -webkit-border-radius: 150px; -moz-border-radius: 150px; background: url(http://link-to-your/image.jpg) no-repeat; box-shadow: 0 0 8px rgba(0, 0, 0, .8); -webkit-box-shadow: 0 0 8px rgba(0, 0, 0, .3); -moz-box-shadow: 0 0 8px rgba(0, 0, 0, .3); }
here's screenshot of random image:
one of options use image background , set this
https://jsfiddle.net/jl5ek6e8/
<div class="circle" style="background-image:url(http://vignette1.wikia.nocookie.net/joke-battles/images/4/40/18360-doge-doge-simple.jpg/revision/latest?cb=20151209161638)"></div> .circle { width:300px; height:300px; border-radius:50%; border:2px solid white; box-shadow: 0 0 20px rgba(0,0,0,.3); background-position:50% 50%; background-repeat:no-repeat; background-size:cover; }
edit
and besides that, why putting background
property on img
tag?
Comments
Post a Comment