Get your own website Result Size: 625 x 565
x
 
<!DOCTYPE html>
<html>
<head>
<style>
form {
  border: 1px solid gray;
  color: gray;
  padding: 10px;
}
form:focus-within {
  border: 2px solid black;
  background-color: beige;
  color: black;
}
</style>
</head>
<body>
<h1>Demo of :focus-within</h1>
<p>Try typing in this form:</p>
<form>
<label for="name">Name: </label><br>
<input id="name" name="name" type="text" /><br>
<label for="email">Email: </label><br>
<input id="email" name="email" type="email" /><br>
<label for="country">Country: </label><br>
<input id="country" name="country" type="text" />
</form>
</body>
</html>