HTML Form How to - Focus rounded corner inputs








Question

We would like to know how to focus rounded corner inputs.

Answer


<!DOCTYPE html>
<html>
<head>
<style type='text/css'>
input {<!--  ww w .j  a va 2 s.c  o  m-->
  border-radius: 20px;
  padding: 5px;
  border: 2px solid #999;
}

input:nth-of-type(2):focus {
  outline: 0;
  box-shadow: 0 0 10px blue;
}
</style>
</head>
<body>
  focus looks bad:
  <input type="text">
  <br>
  <br> focus looks good:
  <input type="text">
</body>
</html>

The code above is rendered as follows: