HTML Element Style How to - Add border to circle image








Question

We would like to know how to add border to circle image.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
.avatar {<!--  www .  j  a va  2 s  .  c o m-->
  width: 128px;
  margin: 10px;
  border: 10px solid red;
  border-radius: 500px;
  -webkit-border-radius: 500px;
  -moz-border-radius: 500px;
}
</style>
</head>
<body>
  <img class="avatar"
    src="http://www.java2s.com/style/download.png"></img>
</body>
</html>

The code above is rendered as follows: