I am trying to make a square picture circular using css 3.
per request posting my entire code
html
<!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;
}
You need to set the
<img>todisplay: blockand set itsborder-radius, instead of or in addition to the parent element. Also you can use50%for circular elements. And removeopacity: 0from the image or it will be invisible. I’ve included abackground-image: url()example as well, in case that is your issue.Demo:
Output:
CSS:
HTML: