Page Widget How to - Make a text inside a circle div








Question

We would like to know how to make a text inside a circle div.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
#ff {<!--   w w  w .j  a v a 2s . c o m-->
  width: 200px;
  height: 200px;
  background-color: red;
  border-radius: 100%;
  text-align: center;
  line-height: 80px;
}

span {
  line-height: normal;
  display: inline-block;
  vertical-align: middle;
}
</style>
</head>
<body>
  <div id="ff">
    hello how
  </div>
  <div id="ff">
    hello how are you
  </div>
</body>
</html>

The code above is rendered as follows: