CSS Focus-within

form {
  border: 1px solid;
  color: gray;
  padding: 4px;
}

form:focus-within label{
  background: #ff8;
  color: black;
}

input {
  margin: 4px;
}
Peter Hirsch-Parker