HTML Element Style How to - Create Div with round border








Question

We would like to know how to create Div with round border.

Answer


<!DOCTYPE html>
<html>
<head>
<style>
div.example {<!--  ww  w .  j av a 2  s .  c o m-->
  position: absolute;
  color: black;
  text-align: left;
  -webkit-border-radius: 15px;
  -moz-border-radius: 15px;
  border-radius: 15px;
  border: 2px solid #000;
  width: 10em;
  height: 15em;
}
</style>
</head>
<body>
  <div class="example" style="height: 15em; width: 10em;"></div>
</body>
</html>

The code above is rendered as follows: