<form action="#">
  <div>
    <input type="text" id="name" tabindex="1" placeholder="Focus Me">
  </div>
</form>
div:focus-within {
 border: 2px solid red;
}

/* DEMO-SPECIFIC STYLES */
body {
  align-items: center;
  background-color: #333;
  display: flex;
  height: 100vh;
  justify-content: center;
}

div {
  padding: 2em;
}

input {
  height: 2em;
  padding: 0 .5em;
  width: 100%;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.