HTML Element Style How to - Mask image with border-radius








Question

We would like to know how to mask image with border-radius.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
img {<!-- www .  j a va 2 s .  c  om-->
  -moz-border-radius: 24px;
  -webkit-border-radius: 24px;
  border-radius: 24px;
  display: block;
}
</style>
</head>
<body>
  <div>
    <img src="http://www.java2s.com/style/download.png">
  </div>
</body>
</html>

The code above is rendered as follows: