HTML Form How to - Remove border from undecorated checkbox








Question

We would like to know how to remove border from undecorated checkbox.

Answer


<!--from  w w w  .java2 s .c  o m-->
<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
input[type="checkbox"] {
  width: 110px;
  height: 110px;
  background: red;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  border: none;
  position: relative;
  left: -5px;
  top: -5px;
}

.checkbox-container {
  position: absolute;
  display: inline-block;
  margin: 20px;
  width: 100px;
  height: 100px;
  overflow: hidden;
}

input[type="checkbox"]:checked {
  background: blue;
}
</style>
</head>
<body>
  <div class="checkbox-container">
    <input type="checkbox" />
  </div>
</body>
</html>

The code above is rendered as follows: