The :focus selector makes it so instead of always showing the textbox as invalid, you’ll first have to focus it. When the input is valid, it’ll keep its green border. We’ll also use outline: 0 to disable the default browser input border focus.

Now you can simply check the password using almost the same regex within PHP: