<form action="#">
  <label for="name">Name:</label>
  <input type="text" id="name" />
  <br />
  <label for="email">E-mail:</label>
  <input type="email" id="email"  />
</form>
form {
  text-align: left;
  background: #f1f1f1;
  border: 2px solid transparent;
  width: 100%;
  padding: 16px;
}

form:focus-within {
  border-color: #AAA;
}

label:not(:first-child) {
  display: inline-block;
  margin: 16px 4px 0 0;
}

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.