JSFiddle - React, Tailwind, and code Playground

by dshilkret

HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Form Layout</title>
<style>
  .form-container {
    max-width: 800px;
    margin: auto;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-family: Arial, sans-serif;
    overflow: hidden;
    padding: 20px;
    box-sizing: border-box;
  }

  .form-header {
    background-color: #f5f5f5;
    padding: 15px;
    text-align: center;
    border-bottom: 1px solid #ddd;
  }

  .form-header h2 {
    margin: 0;
    color: #333;
    font-size: 18px;
  }

  .form-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
  }

  .form-column {
    display: flex;
    flex-direction: column;
    width: 48%; /* Slightly less than half to account for the gap */
  }

  label {
    display: block;
    margin-bottom: 5px;
    color: #666;
  }

  input[type="text"],
  input[type="date"],
  select {
    width: 100%;
    padding: 10px;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-sizing: border-box;
  }

  input[type="text"]:focus,
  input[type="date"]:focus,
  select:focus {
    outline: none;
    border-color: #5c92d1;
  }

  .submit-button {
    padding: 10px 15px;
    border: none;
    border-radius: 4px;
    background-color: #5c92d1;
    color: white;
    cursor: pointer;
    font-size: 16px;
    width: 100%; /* Full width of the column */
  }

  .submit-button:hover {
    background-color: #3e70a8;
  }

  /* Responsive adjustments for smaller screens */
  @media (max-width: 600px) {
    .form-row {
      flex-direction: column;
    }
    .form-column {
      width: 100%; /* Each column takes full width on