Published on

The 5 Really Obvious Ways To Build A Pricing Plans With Tailwind CSS Better That You Ever Did

Pricing plans

What is Tailwind CSS?

Tailwind CSS is a utility-first CSS framework that focuses on creating personalized user interfaces quickly. It can gives you all the building blocks you are able to create personalized designs without having to fight to override irritating opinionated styles. Also, Tailwind CSS is a highly configurable, low-level CSS framework.

The description of Pricing plans ui component

How to create pricing plans

Why use Tailwind CSS to build a Pricing plans ui component?

  • It can make the building process of Pricing plans ui component faster and more easily.
  • Enables building complex responsive layouts and components freely.
  • Minimum lines of CSS code in Pricing plans component file.

The preview of Pricing plans ui component

Free download of the Pricing plans's source code

The source code of Pricing plans ui component

<div class="min-h-screen bg-gray-100 overflow-auto">
  <div class="container mx-auto max-w-4xl">
    <div class="mt-10 text-center">
      <h1 class="text-4xl font-bold text-gray-800">Pricing plans</h1>
      <p class="text-lg mt-3 font-semibold">Every plan includes 30 day free trial</p>
    </div>
    <div class="mt-8">
      <div class="flex justify-between">
        <div>
          <p class="text-sm text-gray-600">For more details on all our pricing visit <span class="underline cursor-pointer text-blue-600">here</span></p>
        </div>
        <div class="flex space-x-16">
          <div class="flex">
            <span class="font-semibold inline mr-4">Plan</span>
            <span class="px-4 py-1 rounded-md text-sm bg-gray-300 flex items-center cursor-pointer"
              >Monthly
              <svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 ml-2" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" />
              </svg>
            </span>
          </div>
          <div class="flex">
            <span class="font-semibold inline mr-4 ">Select currency</span>
            <span class="px-4 py-1 rounded-md text-sm bg-gray-300 flex items-center cursor-pointer">$ USD
              <svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 ml-2" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 9l-7 7-7-7" />
              </svg>
            </span>
          </div>
        </div>
      </div>
      <div></div>
    </div>
    <hr class="mt-10" />
    <div class="flex space-x-10 pt-10">
    <div class="py-12">
      <div class="bg-white pt-4 rounded-xl space-y-6 overflow-hidden  transition-all duration-500 transform hover:-translate-y-6 hover:scale-105 shadow-xl hover:shadow-2xl cursor-pointer">
        <div class="px-8 flex justify-between items-center">
          <h4 class="text-xl font-bold text-gray-800">Hobby</h1>
          <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-gray-700" fill="none" viewBox="0 0 24 24" stroke="currentColor">
            <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5.121 17.804A13.937 13.937 0 0112 16c2.5 0 4.847.655 6.879 1.804M15 10a3 3 0 11-6 0 3 3 0 016 0zm6 2a9 9 0 11-18 0 9 9 0 0118 0z" />
          </svg>
          </div>
          <h1 class="text-4xl text-center font-bold">$10.00</h1>
          <p class="px-4 text-center text-sm ">It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem</p>
          <ul class="text-center">
            <li><a href="#" class="font-semibold">It is a long established</a></li>
            <li><a href="#" class="font-semibold">It is a long established</a></li>
            <li><a href="#" class="font-semibold">It is a long established</a></li>
          </ul>
          <div class="text-center bg-gray-200 ">
        <button class="inline-block my-6 font-bold text-gray-800">Get started today</button>
          </div>
      </div>
    </div>
    <div class="py-12">
      <div class="bg-white  pt-4 rounded-xl space-y-6 overflow-hidden transition-all duration-500 transform hover:-translate-y-6 -translate-y-2 scale-105 shadow-xl hover:shadow-2xl cursor-pointer">
        <div class="px-8 flex justify-between items-center">
          <h4 class="text-xl font-bold text-gray-800">Professional</h1>
          <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-pink-600" fill="none" viewBox="0 0 24 24" stroke="currentColor">
          <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M3 12l2-2m0 0l7-7 7 7M5 10v10a1 1 0 001 1h3m10-11l2 2m-2-2v10a1 1 0 01-1 1h-3m-6 0a1 1 0 001-1v-4a1 1 0 011-1h2a1 1 0 011 1v4a1 1 0 001 1m-6 0h6" />
          </div>
          <h1 class="text-4xl text-center font-bold">$30.00</h1>
          <p class="px-4 text-center text-sm ">It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem</p>
          <ul class="text-center">
            <li><a href="#" class="font-semibold">It is a long established</a></li>
            <li><a href="#" class="font-semibold">It is a long established</a></li>
            <li><a href="#" class="font-semibold">It is a long established</a></li>
          </ul>
          <div class="text-center bg-pink-600 ">
        <button class="inline-block my-6 font-bold text-white">Get started today</button>
          </div>
      </div>
    </div>
    <div class="py-12">
      <div class="bg-white pt-4 rounded-xl space-y-6 overflow-hidden transition-all duration-500 transform hover:-translate-y-6 hover:scale-105 shadow-xl hover:shadow-2xl cursor-pointer">
        <div class="px-8 flex justify-between items-center">
          <h4 class="text-xl font-bold text-gray-800">Business</h1>
          <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-gray-700" fill="none" viewBox="0 0 24 24" stroke="currentColor">
              <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 13.255A23.931 23.931 0 0112 15c-3.183 0-6.22-.62-9-1.745M16 6V4a2 2 0 00-2-2h-4a2 2 0 00-2 2v2m4 6h.01M5 20h14a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v10a2 2 0 002 2z" />
            </svg>
          </div>
          <h1 class="text-4xl text-center font-bold">$45.00</h1>
          <p class="px-4 text-center text-sm ">It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem</p>
          <ul class="text-center">
            <li><a href="#" class="font-semibold">It is a long established</a></li>
            <li><a href="#" class="font-semibold">It is a long established</a></li>
            <li><a href="#" class="font-semibold">It is a long established</a></li>
          </ul>
          <div class="text-center bg-gray-200 ">
        <button class="inline-block my-6 font-bold text-gray-800">Get started today</button>
          </div>
      </div>
    </div>
    </div>
  </div>
</div>

How to build a Pricing plans with Tailwind CSS?

Install tailwind css of verion 2.2.4

Use the script html tag to import the script of Tailwind CSS of the version 2.2.4

<script src="https://cdn.tailwindcss.com"></script>

All the unility class needed to build a Pricing plans component

  • min-h-screen
  • bg-gray-100
  • overflow-auto
  • mx-auto
  • max-w-4xl
  • mt-10
  • text-center
  • text-4xl
  • text-gray-800
  • text-lg
  • mt-3
  • mt-8
  • flex
  • text-sm
  • text-gray-600
  • text-blue-600
  • inline
  • mr-4
  • px-4
  • py-1
  • bg-gray-300
  • h-4
  • w-4
  • ml-2
  • pt-10
  • py-12
  • bg-white
  • pt-4
  • overflow-hidden
  • px-8
  • text-xl
  • h-5
  • w-5
  • text-gray-700
  • bg-gray-200
  • inline-block
  • my-6
  • text-pink-600
  • bg-pink-600
  • text-white

40 steps to build a Pricing plans component with Tailwind CSS

  1. Set the minimum width/height of an element using the min-h-screen utilities.

  2. Control the background color of an element to gray-100 using the bg-gray-100 utilities.

  3. Use overflow-auto to add scrollbars to an element in the event that its content overflows the bounds of that element. Unlike .overflow-scroll, which always shows scrollbars, this utility will only show them if scrolling is necessary.

  4. Control the horizontal margin of an element to auto using the mx-auto utilities.

  5. Set the maximum width/height of an element using the max-w-4xl utilities.

  6. Control the margin on top side of an element to 2.5rem using the mt-10 utilities.

  7. Control the text color of an element to center using the text-center utilities.

  8. Control the text color of an element to 4xl using the text-4xl utilities.

  9. Control the text color of an element to gray-800 using the text-gray-800 utilities.

  10. Control the text color of an element to lg using the text-lg utilities.

  11. Control the margin on top side of an element to 0.75rem using the mt-3 utilities.

  12. Control the margin on top side of an element to 2rem using the mt-8 utilities.

  13. Use flex to create a block-level flex container.

  14. Control the text color of an element to sm using the text-sm utilities.

  15. Control the text color of an element to gray-600 using the text-gray-600 utilities.

  16. Control the text color of an element to blue-600 using the text-blue-600 utilities.

  17. Use inline utilities to control the flow of text inside the element to wrap normally.

  18. Control the margin on right side of an element to 1rem using the mr-4 utilities.

  19. Control the horizontal padding of an element to 1rem using the px-4 utilities.

  20. Control the vertical padding of an element to 0.25rem using the py-1 utilities.

  21. Control the background color of an element to gray-300 using the bg-gray-300 utilities.

  22. Use h-4 to set an element to a fixed height(1rem).

  23. Use w-4 to set an element to a fixed width(1rem).

  24. Control the margin on left side of an element to 0.5rem using the ml-2 utilities.

  25. Control the padding on top side of an element to 2.5rem using the pt-10 utilities.

  26. Control the vertical padding of an element to 3rem using the py-12 utilities.

  27. Control the background color of an element to white using the bg-white utilities.

  28. Control the padding on top side of an element to 1rem using the pt-4 utilities.

  29. Use overflow-hidden to clip any content within an element that overflows the bounds of that element.

  30. Control the horizontal padding of an element to 2rem using the px-8 utilities.

  31. Control the text color of an element to xl using the text-xl utilities.

  32. Use h-5 to set an element to a fixed height(1.25rem).

  33. Use w-5 to set an element to a fixed width(1.25rem).

  34. Control the text color of an element to gray-700 using the text-gray-700 utilities.

  35. Control the background color of an element to gray-200 using the bg-gray-200 utilities.

  36. Use inline-block utilities to wrap the element to prevent the text inside from extending beyond its parent.

  37. Control the vertical margin of an element to 1.5rem using the my-6 utilities.

  38. Control the text color of an element to pink-600 using the text-pink-600 utilities.

  39. Control the background color of an element to pink-600 using the bg-pink-600 utilities.

  40. Control the text color of an element to white using the text-white utilities.

Conclusion

The above is a step-by-step tutorial on how to use Tailwind CSS to build a Pricing plans components, learn and follow along to implement your own components.