skip to Main Content

I can’t seem to get the height of the 1st parent with the bg-neutralSilver div to extend all the way down to the bottom when a y-scrollbar is present. I tried almost all the height settings and also tried adding flex flex-col to it to no avail.

`import React from "react";

const SignUp = () => {
  return (
    <>
      <div className="mt-clearNav bg-neutralSilver min-h-screen">
        <div className="mt-30 px-4 lg:px-14 max-w-screen-2xl mx-auto min-h-screen h-screen  ">
          <section className="p-6 dark:bg-gray-800 dark:text-gray-50">
            <form
              novalidate=""
              action=""
              className="container flex flex-col mx-auto space-y-12"
            >
              <fieldset className="grid grid-cols-4 gap-6 p-6 rounded-md shadow-sm dark:bg-gray-900">
                <div className="space-y-2 col-span-full lg:col-span-1">
                  <p className="font-medium">Personal Inormation</p>
                  <p className="text-xs">
                    Please provide us with personal information for our records.
                    The information given will only be used as needed for
                    administrative purposes. We abide strictly by PDPA
                    guidelines.Your privacy is in our best interest
                  </p>
                </div>
                <div className="grid grid-cols-6 gap-4 col-span-full lg:col-span-3">
                  <div className="col-span-full sm:col-span-3">
                    <label for="firstname" className="text-sm">
                      First name
                    </label>
                    <input
                      id="firstname"
                      type="text"
                      placeholder="First name"
                      className="w-full rounded-md focus:ring focus:ri focus:ri dark:border-gray-700 dark:text-gray-900"
                    />
                  </div>
                  <div className="col-span-full sm:col-span-3">
                    <label for="lastname" className="text-sm">
                      Last name
                    </label>
                    <input
                      id="lastname"
                      type="text"
                      placeholder="Last name"
                      className="w-full rounded-md focus:ring focus:ri focus:ri dark:border-gray-700 dark:text-gray-900"
                    />
                  </div>
                  <div className="col-span-full sm:col-span-3">
                    <label for="email" className="text-sm">
                      Email
                    </label>
                    <input
                      id="email"
                      type="email"
                      placeholder="Email"
                      className="w-full rounded-md focus:ring focus:ri focus:ri dark:border-gray-700 dark:text-gray-900"
                    />
                  </div>
                  <div className="row-start-3 col-span-3 sm:col-span-2 md:col-span-2 ">
                    <label for="nric" className="text-sm">
                      NRIC
                    </label>
                    <input
                      id="nric"
                      type="text"
                      placeholder="S1234567A"
                      className="w-full rounded-md focus:ring focus:ri focus:ri dark:border-gray-700 dark:text-gray-900"
                    />
                  </div>
                  <div className="row-start-3 col-span-2 sm:col-span-1 pr-20">
                    <label for="age" className="text-sm">
                      Age
                    </label>
                    <input
                      id="age"
                      type="number"
                      className="w-full rounded-md focus:ring focus:ri focus:ri dark:border-gray-700 dark:text-gray-900"
                    />
                  </div>
                  <div className="row-start-4 col-span-3 sm:col-span-2 md:col-span-2 ">
                    <label for="contact" className="text-sm">
                      Contact
                    </label>
                    <input
                      id="contact"
                      type="tel"
                      placeholder="+65 12345678"
                      className="w-full rounded-md focus:ring focus:ri focus:ri dark:border-gray-700 dark:text-gray-900"
                    />
                  </div>
                  <div className="col-span-full">
                    <label for="address" className="text-sm">
                      Address
                    </label>
                    <input
                      id="address"
                      type="text"
                      placeholder=""
                      className="w-full rounded-md focus:ring focus:ri focus:ri dark:border-gray-700 dark:text-gray-900"
                    />
                  </div>
                  <div className="col-span-full sm:col-span-2">
                    <label for="city" className="text-sm">
                      City
                    </label>
                    <input
                      id="city"
                      type="text"
                      placeholder=""
                      className="w-full rounded-md focus:ring focus:ri focus:ri dark:border-gray-700 dark:text-gray-900"
                    />
                  </div>
                  <div className="col-span-full sm:col-span-2">
                    <label for="state" className="text-sm">
                      State / Province
                    </label>
                    <input
                      id="state"
                      type="text"
                      placeholder=""
                      className="w-full rounded-md focus:ring focus:ri focus:ri dark:border-gray-700 dark:text-gray-900"
                    />
                  </div>
                  <div className="col-span-full sm:col-span-2">
                    <label for="zip" className="text-sm">
                      ZIP / Postal
                    </label>
                    <input
                      id="zip"
                      type="text"
                      placeholder=""
                      className="w-full rounded-md focus:ring focus:ri focus:ri dark:border-gray-700 dark:text-gray-900"
                    />
                  </div>
                </div>
              </fieldset>
              <fieldset className="grid grid-cols-4 gap-6 p-6 rounded-md shadow-sm dark:bg-gray-900">
                <div className="space-y-2 col-span-full lg:col-span-1">
                  <p className="font-medium">Set your password</p>
                  <p className="text-xs">Please set a strong password.</p>
                </div>
                <div className="grid grid-cols-6 gap-4 col-span-full lg:col-span-3">
                  <div className="col-span-full sm:col-span-3">
                    <label for="firstname" className="text-sm">
                      Password
                    </label>
                    <input
                      id="password"
                      type="password"
                      className="w-full rounded-md focus:ring focus:ri focus:ri dark:border-gray-700 dark:text-gray-900"
                    />
                  </div>
                </div>
                <div>
                  <button className="bg-primary text-white py-2 px-4 transition-all duration-300 rounded hover:bg-neutralGrey">
                    Submit
                  </button>
                </div>
              </fieldset>
            </form>
          </section>
        </div>
      </div>
    </>
  );
};

export default SignUp;`

I would like to have the 1st div container extend all the way to the bottom of the page even with a Y-scrollbar present using tailwind css. Thank you

2

Answers


  1. The h-min-screen ensures that this div, will have a minimum height equal to the screen size, but you’re not specifying how this container should grow when there’s more space available.

    If you make sure that his direct parent container is higher than the div you want to expand, adding a flex class to your div, should me enough to take the whole space

    Login or Signup to reply.
  2. What styles you applied for the parent element of the element you want to have a full height? Make sure that element has no fixed height. Then apply h-full class to both.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search