HTML Form How to - hover to style input








Question

We would like to know how to hover to style input.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
#popUpYes {<!--from   ww  w . j a  v a  2 s .c om-->
  width: 60px;
  height: 30px;
  background-color: black;
}

#popUpYes:hover {
  background-color: white;
}
</style>
</head>
<body>
  <input type="submit" value="Yes" id="popUpYes">
</body>
</html>

The code above is rendered as follows: