UNIT 24 • STAGE 5 OF 7

Reservations

Form with date, time, and party-size inputs plus a footer

UNIT 5 / 7
STEP 1

Specialized Input Types

HTML has input types beyond type="text" and type="email". Two are especially useful for a reservation form:

  • type="date", gives the user a date picker in the browser. No JavaScript library required.
  • type="time", gives the user a time picker. Again, built into the browser.

The <select> element creates a dropdown menu. Each option is an <option> element nested inside. This is how you offer a fixed set of choices, perfect for party size.

STEP 2

Add the Reservation CSS

Add this after the about CSS:

👉 Add reservation + footer CSS: #reservations { background: var(--cedar); padding: 80px 0; }
.res-heading { font-family: var(--font-display); font-size: clamp(2rem, 4vw, 3rem); font-weight: 700; color: var(--cream); margin-bottom: 8px; }
.res-sub { color: rgba(245,240,230,0.6); font-size: 1rem; margin-bottom: 48px; }
.res-form { background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); border-radius: 20px; padding: 48px; max-width: 680px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-bottom: 20px; }
.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-group label { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(245,240,230,0.6); }
.form-group input, .form-group select { background: rgba(255,255,255,0.06); border: 1px solid rgba(255,255,255,0.15); color: var(--cream); padding: 12px 16px; border-radius: 8px; font-family: var(--font-body); font-size: 0.9375rem; outline: none; transition: border-color 0.2s; }
.form-group input:focus, .form-group select:focus { border-color: var(--ember); }
.res-btn { background: var(--ember); color: white; border: none; padding: 16px 40px; border-radius: 8px; font-size: 0.875rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; cursor: pointer; }
footer { background: #0d0906; color: rgba(245,240,230,0.4); padding: 32px 0; text-align: center; font-size: 0.875rem; }
  • .form-grid uses grid-template-columns: 1fr 1fr again, same pattern as the about section: two columns, each taking equal space. This puts name/email side by side, and date/time side by side.
  • outline: none on inputs removes the browser's default blue focus ring. The :focus rule replaces it with a cleaner ember-colored border.
  • .form-group select option { background: #2a1208; }, without this, dropdown options would show with the OS default white background, breaking the dark theme.
STEP 3

Add the Form HTML

After the about section, add the reservations section and footer:

👉 Form structure (key parts): <div class="form-grid">
  <div class="form-group">
    <label for="date">Date</label>
    <input type="date" id="date">
  </div>
  <div class="form-group">
    <label for="time">Time</label>
    <input type="time" id="time">
  </div>
</div>
<!-- Party size select -->
<div class="form-group">
  <label for="party">Party Size</label>
  <select id="party">
    <option>2 guests</option>
    <option>3 guests</option>
  </select>
</div>

Stage 5 Complete

You now have a reservation form with a two-column grid, date/time pickers, a party-size dropdown, and a simple footer.

Next: Stage 6 adds the fixed header: pinned to the top, transparent over the hero.

Code Editor
Live Preview