HTML Form How to - Create three states button








Question

We would like to know how to create three states button.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
a {<!--from w  w  w . ja v  a2s.  c  o  m-->
  font-family: arial;
  text-shadow: 0 -1px 0px #d35400;
  position: relative;
  color: #FFF;
  text-decoration: none;
  background-color: #f1c40f;
  border-radius: 5px;
  box-shadow: 0px 4px 0px #d35400;
  width: 250px;
  text-align: center;
  font-weight: bold;
  transition: all .1s ease;
  font-size: 14px;
  padding: 10px;
  text-transform: uppercase;
}

a:hover {
  background: #f39c12;
  color: #FFF;
  box-shadow: 0px 2px 0px #d35400;
  top: 2px;
}

a:active {
  background: #d35400;
  box-shadow: 0px 0 0px #d35400;
  top: 4px;
}
</style>
</head>
<body>
  <a href="#">OK</a>
</body>
</html>

The code above is rendered as follows: