Published on

6 Ideas To Help You Create A Responsive Vertical Timeline With Tailwind CSS Like A Pro

Responsive Vertical Timeline

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 Responsive Vertical Timeline ui component

Simple responsive vertical timeline

Why use Tailwind CSS to build a Responsive Vertical Timeline ui component?

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

The preview of Responsive Vertical Timeline ui component

Free download of the Responsive Vertical Timeline's source code

The source code of Responsive Vertical Timeline ui component

<div class="w-10/12 md:w-7/12 lg:6/12 mx-auto relative py-20">
      <h1 class="text-3xl text-center font-bold text-blue-500">Timeline with Tailwindcss</h1>
      <div class="border-l-2 mt-10">
        <!-- Card 1 -->
        <div class="transform transition cursor-pointer hover:-translate-y-2 ml-10 relative flex items-center px-6 py-4 bg-blue-600 text-white rounded mb-10 flex-col md:flex-row space-y-4 md:space-y-0">
          <!-- Dot Follwing the Left Vertical Line -->
          <div class="w-5 h-5 bg-blue-600 absolute -left-10 transform -translate-x-2/4 rounded-full z-10 mt-2 md:mt-0"></div>

          <!-- Line that connecting the box with the vertical line -->
          <div class="w-10 h-1 bg-blue-300 absolute -left-10 z-0"></div>

          <!-- Content that showing in the box -->
          <div class="flex-auto">
            <h1 class="text-lg">Day 1</h1>
            <h1 class="text-xl font-bold">Orientation and Briefing on Uniliver basics</h1>
            <h3>Classroom</h3>
          </div>
          <a href="#" class="text-center text-white hover:text-gray-300">Download materials</a>
        </div>

        <!-- Card 2 -->
        <div class="transform transition cursor-pointer hover:-translate-y-2 ml-10 relative flex items-center px-6 py-4 bg-pink-600 text-white rounded mb-10 flex-col md:flex-row space-y-4 md:space-y-0">
          <!-- Dot Follwing the Left Vertical Line -->
          <div class="w-5 h-5 bg-pink-600 absolute -left-10 transform -translate-x-2/4 rounded-full z-10 mt-2 md:mt-0"></div>

          <!-- Line that connecting the box with the vertical line -->
          <div class="w-10 h-1 bg-pink-300 absolute -left-10 z-0"></div>

          <!-- Content that showing in the box -->
          <div class="flex-auto">
            <h1 class="text-lg">Day 1</h1>
            <h1 class="text-xl font-bold">Orientation and Briefing on Uniliver basics</h1>
            <h3>Classroom</h3>
          </div>
          <a href="#" class="text-center text-white hover:text-gray-300">Download materials</a>
        </div>

        <!-- Card 3 -->
        <div class="transform transition cursor-pointer hover:-translate-y-2 ml-10 relative flex items-center px-6 py-4 bg-green-600 text-white rounded mb-10 flex-col md:flex-row space-y-4 md:space-y-0">
          <!-- Dot Follwing the Left Vertical Line -->
          <div class="w-5 h-5 bg-green-600 absolute -left-10 transform -translate-x-2/4 rounded-full z-10 mt-2 md:mt-0"></div>

          <!-- Line that connecting the box with the vertical line -->
          <div class="w-10 h-1 bg-green-300 absolute -left-10 z-0"></div>

          <!-- Content that showing in the box -->
          <div class="flex-auto">
            <h1 class="text-lg">Day 1</h1>
            <h1 class="text-xl font-bold">Orientation and Briefing on Uniliver basics</h1>
            <h3>Classroom</h3>
          </div>
          <a href="#" class="text-center text-white hover:text-gray-300">Download materials</a>
        </div>

        <!-- Card 4 -->
        <div class="transform transition cursor-pointer hover:-translate-y-2 ml-10 relative flex items-center px-6 py-4 bg-purple-600 text-white rounded mb-10 flex-col md:flex-row space-y-4 md:space-y-0">
          <!-- Dot Follwing the Left Vertical Line -->
          <div class="w-5 h-5 bg-purple-600 absolute -left-10 transform -translate-x-2/4 rounded-full z-10 mt-2 md:mt-0"></div>

          <!-- Line that connecting the box with the vertical line -->
          <div class="w-10 h-1 bg-purple-300 absolute -left-10 z-0"></div>

          <!-- Content that showing in the box -->
          <div class="flex-auto">
            <h1 class="text-lg">Day 1</h1>
            <h1 class="text-xl font-bold">Orientation and Briefing on Uniliver basics</h1>
            <h3>Classroom</h3>
          </div>
          <a href="#" class="text-center text-white hover:text-gray-300">Download materials</a>
        </div>

        <!-- Card 5 -->
        <div class="transform transition cursor-pointer hover:-translate-y-2 ml-10 relative flex items-center px-6 py-4 bg-yellow-600 text-white rounded mb-10 flex-col md:flex-row">
          <!-- Dot Follwing the Left Vertical Line -->
          <div class="w-5 h-5 bg-yellow-600 absolute -left-10 transform -translate-x-2/4 rounded-full z-10 -mt-2 md:mt-0"></div>

          <!-- Line that connecting the box with the vertical line -->
          <div class="w-10 h-1 bg-yellow-300 absolute -left-10 z-0"></div>

          <!-- Content that showing in the box -->
          <div class="flex-auto">
            <h1 class="text-lg">Day 1</h1>
            <h1 class="text-xl font-bold">Orientation and Briefing on Uniliver basics</h1>
            <h3>Classroom</h3>
          </div>
          <a href="#" class="text-center text-white hover:text-gray-300">Download materials</a>
        </div>
      </div>
    <section class="mt-4 text-center">Build with ❤️ by <a href="https://github.com/saadh393" target="_blank">Saad Hasan </a></section>
    </div>

How to build a Responsive Vertical Timeline with Tailwind CSS?

Install tailwind css of verion 3.0.18

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

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

All the unility class needed to build a Responsive Vertical Timeline component

  • w-10/12
  • md:w-7/12
  • mx-auto
  • relative
  • py-20
  • text-3xl
  • text-center
  • text-blue-500
  • border-l-2
  • mt-10
  • ml-10
  • flex
  • px-6
  • py-4
  • bg-blue-600
  • text-white
  • mb-10
  • flex-col
  • md:flex-row
  • w-5
  • h-5
  • absolute
  • -left-10
  • z-10
  • mt-2
  • md:mt-0
  • w-10
  • h-1
  • bg-blue-300
  • z-0
  • flex-auto
  • text-lg
  • text-xl
  • hover:text-gray-300
  • bg-pink-600
  • bg-pink-300
  • bg-green-600
  • bg-green-300
  • bg-purple-600
  • bg-purple-300
  • bg-yellow-600
  • -mt-2
  • bg-yellow-300
  • mt-4

44 steps to build a Responsive Vertical Timeline component with Tailwind CSS

  1. Use w-10/12 to set an element to a fixed width(10/12).

  2. Use md:w-7/12 to set an element to a fixed width(7/12) at only medium screen sizes.

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

  4. Use relative to position an element according to the normal flow of the document.

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

  6. Control the text color of an element to 3xl using the text-3xl 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 blue-500 using the text-blue-500 utilities.

  9. Control the border color of an element to l-2 using the border-l-2 utilities.

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

  11. Control the margin on left side of an element to 2.5rem using the ml-10 utilities.

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

  13. Control the horizontal padding of an element to 1.5rem using the px-6 utilities.

  14. Control the vertical padding of an element to 1rem using the py-4 utilities.

  15. Control the background color of an element to blue-600 using the bg-blue-600 utilities.

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

  17. Control the margin on bottom side of an element to 2.5rem using the mb-10 utilities.

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

  19. Use flex to create a block-level flex container at only medium screen sizes.

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

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

  22. Use absolute to position an element outside of the normal flow of the document, causing neighboring elements to act as if the element doesn’t exist.

  23. Use the -left-10 utilities to set the left position of a positioned element to -2.5rem.

  24. Control the stack order (or three-dimensional positioning) of an element to 10 in Tailwind, regardless of order it has been displayed, using the z-10 utilities.

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

  26. Control the margin on top side of an element to 0rem at only medium screen sizes using the md:mt-0 utilities.

  27. Use w-10 to set an element to a fixed width(2.5rem).

  28. Use h-1 to set an element to a fixed height(0.25rem).

  29. Control the background color of an element to blue-300 using the bg-blue-300 utilities.

  30. Control the stack order (or three-dimensional positioning) of an element to 0 in Tailwind, regardless of order it has been displayed, using the z-0 utilities.

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

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

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

  34. Control the text color of an element to gray-300 on hover using the hover:text-gray-300 utilities.

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

  36. Control the background color of an element to pink-300 using the bg-pink-300 utilities.

  37. Control the background color of an element to green-600 using the bg-green-600 utilities.

  38. Control the background color of an element to green-300 using the bg-green-300 utilities.

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

  40. Control the background color of an element to purple-300 using the bg-purple-300 utilities.

  41. Control the background color of an element to yellow-600 using the bg-yellow-600 utilities.

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

  43. Control the background color of an element to yellow-300 using the bg-yellow-300 utilities.

  44. Control the margin on top side of an element to 1rem using the mt-4 utilities.

Conclusion

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