HTML Element Style How to - Use border-radius to cut off image








Question

We would like to know how to use border-radius to cut off image.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
img {<!-- w w w  .  j a va  2  s  .c o  m-->
  width: 200px;
  height: 200px;
  border-radius: 100px;
  -moz-border-radius: 100px;
  margin: 5px;
}

.round {
  border-radius: 100px;
  box-shadow: 0 0 0 5px #000;
}
</style>
</head>
<body>
  <img class="round"
    src="http://www.java2s.com/style/download.png">
</body>
</html>

The code above is rendered as follows: