<!DOCTYPE html>
<html>
<body>
  <style>
    /* Override the default :invalid style. */
    :invalid { box-shadow: none; }
  </style>
  <input size="20" maxlength="2">
  <script>
    document.body.offsetWidth;
    document.getElementsByTagName("input")[0].value = "abcde";
  </script>
</body>
</html>