<html lang="en">
  <head>
    <meta charset="utf-8"/>
    <title>Styling basics: Task 1</title>

  </head>

  <body>
    <form>
      <h2>Edit your preferences</h2>
      <ul>
        <li>
          <label for="e-mail">Email:</label>
          <input type="email" id="e-mail" name="e-mail">
        </li>
        <li>
          <label for="website">Website:</label>
          <input type="url" id="website" name="website">
        </li>
        <li>
          <label for="phone">Phone number:</label>
          <input type="tel" id="phone" name="phone">
        </li>
        <li>
          <label for="food">Favorite food:</label>
          <select name="food" id="food">
            <option>Salad</option>
            <option>Curry</option>
            <option>Pizza</option>
            <option>Fajitas</option>
          </select>
        </li>
        <li>
          <button>Update preferences</button>
        </li>
      </ul>
    </form>
  </body>

</html>
* {
  box-sizing: border-box;
}

body {
  background-color: #fff;
  color: #333;
  font: 1em / 1.4 Helvetica Neue, Helvetica, Arial, sans-serif;
  padding: 1em;
  width: 500px;
}

/* My code from here */

body{
  margin: 0 auto;
}

form {
  background-color: lavender;
  padding: 0.5rem 1rem;
}

/* revised */
ul {
  list-style-type: none;
  padding: 0 10px;
}

li {
  display: flex;
  padding-bottom: 10px;
}

label {
  width: 11rem;
}

li :nth-child(2), button {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  width: 100%;
  font-family: inherit;
  font-size: 14px;
}

li :nth-child(2) {
  border: 2px solid rebeccapurple;
  border-radius: 5px;
  height: 1.5rem;
  padding: 0 5px;
}

li :nth-child(2):focus {
  background: rgb(254, 254, 169);
}

button {
  width: 12rem;
  height: 2rem;
  border: 2px solid gray;
  border-radius: 5px;
  cursor: pointer;
}

button:focus,
button:hover {
  background-color: rebeccapurple;
  color: white;
}

/* original
ul {
  list-style-type: none;
  display: grid;
  grid-gap: 10px;
  grid-template-rows: repeat(4, 1fr) 2.5rem;
  padding: 0 10px;
}

li {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  grid-gap: 5px;
}


label {
  grid-column: 1 / 2;
}

li :nth-child(2), button {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  width: 100%;
  font-family: inherit;
  font-size: 14px;
}

li :nth-child(2) {
  grid-column: 2 / 3;
  border: 2px solid rebeccapurple;
  border-radius: 5px;
  height: 1.5rem;
  align-self: center;
  padding: 0 5px;
}

li :nth-child(2):focus {
  background: rgb(254, 254, 169);
}

button {
  grid-column: 1 / 3;
  width: 12rem;
  height: 2rem;
  justify-self: center;
  align-self: center;
  border: 2px solid gray;
  border-radius: 5px;
  cursor: pointer;
}

button:focus,
button:hover {
  background-color: rebeccapurple;
  color: white;
}

*/
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.