Css3 round image not working

I am trying to make a square circular pattern using css 3.

for requesting the placement of my entire HTML code

<!DOCTYPE html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>Hello</title>
    <link type="text/css" href="home_page.css" rel="stylesheet" />
  </head>
  <body>
<span class="image-wrap " style="display:inline-block; background:url(pic1.png);">
<img src="pic1.png" style="opacity: 0;"></span>
 </body>
</html>

css: inside home_page.css

.image-wrap {
    -webkit-border-radius: 50em;
    -moz-border-radius: 50em;
    border-radius: 50em;
}
+5
source share
1 answer

You need to install <img>in display: blockand install it border-radiusinstead of or in addition to the parent element. Also you can use 50%for circular elements. And remove opacity: 0from the image or it will be invisible. I also included an example background-image: url()if this is your problem.

Demo: jsFiddlesub> sub>

Conclusion:

enter image description here

CSS

.circle {
    border: 1px solid black;
    border-radius: 50%;
    display: inline-block;
}
.circle img {
    border-radius: 50%;
    display: block;
}
.background-circle {
    background-image: url( 'http://lorempixel.com/200/200/cats/' );
    height: 200px;
    width: 200px;
}

HTML:

<div class="circle"><img src="http://lorempixel.com/200/200/cats/" /></div>
<div class="background-circle circle"></div>
+10
source

All Articles