HTML Form How to - Make label circle








Question

We would like to know how to make label circle.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
label {<!--   www  .  j  a v a  2 s . co  m-->
  width: 100px;
  height: 100px;
  border: 3px solid #000;
  border-radius: 50%;
  cursor: pointer;
  display: block;
}

input {
  display: none;
}

#a:checked ~ [for=a] {
  background-color: red;
}

#b:checked ~ [for=b] {
  background-color: orange;
}

#c:checked ~ [for=c] {
  background-color: green;
}
</style>
</head>
<body>
  <input type="checkbox" id="a" />
  <input type="checkbox" id="b" />
  <input type="checkbox" id="c" />
  <label for="a"></label>
  <label for="b"></label>
  <label for="c"></label>
</body>
</html>

The code above is rendered as follows: