Back to Freecodecamp

Step 15

curriculum/challenges/english/blocks/workshop-tailwind-pricing-component/6864e580f94941dcfa2bb26d.md

latest3.3 KB
Original Source

--description--

Now you should work on the placement of the items inside the card for the plan.

To do this, set the container to use grid display and specify a custom row size using square brackets in your Tailwind class.

Here's how you can set a custom grid row using fractional units:

html
<div class="grid grid-rows-[2fr]">
  <div>Takes one part</div>
  <div>Takes two parts of available space</div>
</div>

Give the outer div for the plan the utility classes grid and grid-rows-[1fr_auto].

--hints--

Your div element should have the class grid.

js
const listenerPlanWrapper = document.querySelectorAll("div")[1]

assert.isTrue(listenerPlanWrapper.classList.contains("grid"))

Your div element should have the class grid-rows-[1fr_auto].

js
const listenerPlanWrapper = document.querySelectorAll("div")[1]

assert.isTrue(listenerPlanWrapper.classList.contains("grid-rows-[1fr_auto]"))

--seed--

--seed-contents--

html
<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Music App Pricing</title>
    <script src="https://cdn.tailwindcss.com"></script>
  </head>
  <body class="bg-gray-100">
    <main>
      <h1 class="mt-8 mb-12 text-center text-3xl md:text-5xl font-semibold text-gray-900">Choose your listening plan</h1>
      <div class="grid grid-cols-1 md:grid-cols-3 max-w-6xl mx-auto gap-8 mt-16">
        --fcc-editable-region--
        <div class="bg-gray-100 ring-1 ring-gray-300 ">
          <div>
            <h2>Listener</h2>
            <p>$0<span>/month</span></p>
            <p>
              Start exploring millions of songs with basic features and ads.
            </p>
            <ul>
              <li><span>&#10003;</span>Ad-supported streaming</li>
              <li><span>&#10003;</span>Curated playlists</li>
            </ul>
          </div>
          <a href="#">Start listening</a>
        </div>
        --fcc-editable-region--
        <div>
          <div>Most Popular</div>
          <div>
            <h2>Premium</h2>
            <p>$9.99<span>/month</span></p>
            <p>
              Enjoy the full music experience with unlimited access and
              downloads.
            </p>
            <ul>
              <li><span>&#10003;</span>Ad-free listening</li>
              <li><span>&#10003;</span>Offline playback</li>
              <li><span>&#10003;</span>Unlimited skips</li>
            </ul>
          </div>
          <a href="#">Go Premium</a>
        </div>
        <div>
          <div>
            <h2>Family</h2>
            <p>$14.99<span>/month</span></p>
            <p>
              Enjoy all of the features with a plan for up to 6 family members.
            </p>
            <ul>
              <li>
                <span>&#10003;</span>All Premium features
              </li>
              <li>
                <span>&#10003;</span>Up to 6 accounts
              </li>
              <li>
                <span>&#10003;</span>Individual playlists &
                libraries
              </li>
              <li>
                <span>&#10003;</span>Family Mix playlists
              </li>
            </ul>
          </div>
          <a href="#">Start Family Plan</a>
        </div>
      </div>
    </main>
  </body>
</html>