HTML Element Style How to - Add rounded corners and border to Table header








Question

We would like to know how to add rounded corners and border to Table header.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
th div {<!-- ww  w.j  a  va  2  s.  c  o  m-->
  border: 1px solid black;
  width: 80px;
  text-align: center;
  border-radius: 10px;
}
</style>
</head>
<body>
  <table>
    <tr>
      <th><div>A</div></th>
      <th><div>B</div></th>
      <th><div>C</div></th>
      <th><div>D</div></th>
    </tr>
  </table>
</body>
</html>

The code above is rendered as follows: