Menu

Styling the Form & Layout

Styling the Form & Layout

File Path: ContactUsForm\src\App.css
@import "tailwindcss";

.main-wrapper {
  background-color: #e8f0fe;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 2.5px;
  margin-bottom: 16px;
  position: relative;
}

.form-label {
  user-select: none;
}

label {
  display: inline-block;
}

.form-group input,
select,
textarea {
  border: 1px solid #cacaca;
  background-color: white;
  border-radius: 6px;
  padding: 8px;
  width: 100%;
  outline: none;
  caret-color: #3b71fe;
}

.form-group textarea {
  height: 150px;
}

.form-inputs-container {
  padding: 15px;
}

.form-group input[type="checkbox"] {
  position: absolute;
  opacity: 0;
}

.form-group input[type="checkbox"] + label {
  padding-left: 30px;
  position: relative;
  cursor: pointer;
}

.form-group input[type="checkbox"] + label:before {
  content: "";
  position: absolute;
  width: 19px;
  height: 19px;
  border: 1px solid blue;
  left: 0;
  top: 3px;
  border-radius: 2px;
  transition: 0.2s;
  cursor: pointer;
  background-color: white;
}

.form-group input[type="checkbox"]:checked + label:before {
  background: blue;
}

.form-group input[type="checkbox"] + label:after {
  content: "";
  left: 3px;
  top: 7px;
  color: white;
  position: absolute;
  width: 13px;
  height: 8px;
  border-bottom: solid 3px white;
  border-left: solid 3px white;
  transform: rotate(-45deg);
  transition: 0.2s;
  cursor: pointer;
  opacity: 0;
}

.form-group input[type="checkbox"]:checked + label:after {
  opacity: 1;
}

.form-group input[type="submit"] {
  border: none;
  border-radius: 8px;
  background-color: red;
  color: white;
  font-weight: 500;
  font-size: 18px;
  opacity: 0.9;
  /* transition: 0.3s; */
  width: 30%;
}
.form-group input[type="submit"]:hover {
  opacity: 1;
  cursor: pointer;
  font-weight: 400;
}

.form-wrapper {
  border-radius: 8px;
  overflow: hidden;
  background-color: #f9f9f9;
  border: 1px solid #e0e0e0;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.3);
}

.form-wrapper .form-head {
  background-color: #4e80d8;
}
.form-wrapper .form-head h1 {
  text-align: center;
  color: white;
  font-weight: 700;
}

#services {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
}

.react-tel-input .form-control {
  width: 100% !important;
  height: 41.33px !important;
  padding-bottom: 0px;
}

.react-tel-input .selected-flag {
  top: 3px;
}

.back-btn {
  background-color: red;
  color: white;
  padding: 6px 20px;
  border-radius: 8px;
  transition: 0.3s;
  opacity: 0.9;
  font-weight: 400;
}

.back-btn:hover {
  opacity: 1;
  cursor: pointer;
}

.thankyou-text {
  font-weight: 500;
}

/* Responsiveness */
@media (max-width: 600px) {
  .form-group {
    margin-bottom: 8px;
    font-size: 14px;
  }
  .form-inputs-container {
    padding: 15px 15px 4px;
  }
  .form-group input[type="submit"] {
    font-size: 16px;
  }
  .form-group input,
  select,
  textarea {
    padding: 4px;
  }
  .form-group textarea {
    height: 100px;
  }

  .form-group p {
    font-size: 12px;
  }
  #agreement-line + label {
    font-size: 12px;
  }
  .react-tel-input .form-control {
    height: 30.33px !important;
  }
  .react-tel-input .selected-flag .flag {
    margin-top: -7px !important;
  }
}

Explanation:

The App.css file contains the styling for the App component and applies general layout and design rules across the app.