- Published on
Learn How To Build A Responsive Vertical Timeline With Tailwind CSS Like an Expert

- What is Tailwind CSS?
- The description of Responsive Vertical Timeline ui component
- Why use Tailwind CSS to make a Responsive Vertical Timeline ui component?
- The preview of Responsive Vertical Timeline ui component
- The source code of Responsive Vertical Timeline ui component
- How to make a Responsive Vertical Timeline with Tailwind CSS?
- Install tailwind css of verion 2.2.4
- All the unility class needed to make a Responsive Vertical Timeline component
- 40 steps to make a Responsive Vertical Timeline component with Tailwind CSS
- Conclusion
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
A simple responsive alternating timeline component.
Why use Tailwind CSS to make 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="min-h-screen bg-blue-500 py-6 flex flex-col justify-center sm:py-12">
<div class="py-3 sm:max-w-xl sm:mx-auto w-full px-2 sm:px-0">
<div class="relative text-gray-700 antialiased text-sm font-semibold">
<!-- Vertical bar running through middle -->
<div class="hidden sm:block w-1 bg-blue-300 absolute h-full left-1/2 transform -translate-x-1/2"></div>
<!-- Left section, set by justify-start and sm:pr-8 -->
<div class="mt-6 sm:mt-0 sm:mb-12">
<div class="flex flex-col sm:flex-row items-center">
<div class="flex justify-start w-full mx-auto items-center">
<div class="w-full sm:w-1/2 sm:pr-8">
<div class="p-4 bg-white rounded shadow">
Now this is a story all about how,
</div>
</div>
</div>
<div class="rounded-full bg-blue-500 border-white border-4 w-8 h-8 absolute left-1/2 -translate-y-4 sm:translate-y-0 transform -translate-x-1/2 flex items-center justify-center">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 6.253v13m0-13C10.832 5.477 9.246 5 7.5 5S4.168 5.477 3 6.253v13C4.168 18.477 5.754 18 7.5 18s3.332.477 4.5 1.253m0-13C13.168 5.477 14.754 5 16.5 5c1.747 0 3.332.477 4.5 1.253v13C19.832 18.477 18.247 18 16.5 18c-1.746 0-3.332.477-4.5 1.253" />
</svg>
</div>
</div>
</div>
<!-- Right section, set by justify-end and sm:pl-8 -->
<div class="mt-6 sm:mt-0 sm:mb-12">
<div class="flex flex-col sm:flex-row items-center">
<div class="flex justify-end w-full mx-auto items-center">
<div class="w-full sm:w-1/2 sm:pl-8">
<div class="p-4 bg-white rounded shadow">
My life got flipped turned upside down,
</div>
</div>
</div>
<div class="rounded-full bg-blue-500 border-white border-4 w-8 h-8 absolute left-1/2 -translate-y-4 sm:translate-y-0 transform -translate-x-1/2 flex items-center justify-center">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" />
</svg>
</div>
</div>
</div>
<!-- Left section, set by justify-start and sm:pr-8 -->
<div class="mt-6 sm:mt-0 sm:mb-12">
<div class="flex flex-col sm:flex-row items-center">
<div class="flex justify-start w-full mx-auto items-center">
<div class="w-full sm:w-1/2 sm:pr-8">
<div class="p-4 bg-white rounded shadow">
And I'd like to take a minute, just sit right there,
</div>
</div>
</div>
<div class="rounded-full bg-blue-500 border-white border-4 w-8 h-8 absolute left-1/2 -translate-y-4 sm:translate-y-0 transform -translate-x-1/2 flex items-center justify-center">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 8v4l3 3m6-3a9 9 0 11-18 0 9 9 0 0118 0z" />
</svg>
</div>
</div>
</div>
<!-- Right section, set by justify-end and sm:pl-8 -->
<div class="mt-6 sm:mt-0">
<div class="flex flex-col sm:flex-row items-center">
<div class="flex justify-end w-full mx-auto items-center">
<div class="w-full sm:w-1/2 sm:pl-8">
<div class="p-4 bg-white rounded shadow">
I'll tell you how I became the Prince of a town called Bel Air.
</div>
</div>
</div>
<div class="rounded-full bg-blue-500 border-white border-4 w-8 h-8 absolute left-1/2 -translate-y-4 sm:translate-y-0 transform -translate-x-1/2 flex items-center justify-center">
<svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5 text-white" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 17h5l-1.405-1.405A2.032 2.032 0 0118 14.158V11a6.002 6.002 0 00-4-5.659V5a2 2 0 10-4 0v.341C7.67 6.165 6 8.388 6 11v3.159c0 .538-.214 1.055-.595 1.436L4 17h5m6 0v1a3 3 0 11-6 0v-1m6 0H9" />
</svg>
</div>
</div>
</div>
</div>
</div>
</div>
How to make a Responsive Vertical Timeline 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 make a Responsive Vertical Timeline component
min-h-screen
bg-blue-500
py-6
flex
flex-col
sm:py-12
py-3
sm:max-w-xl
sm:mx-auto
w-full
px-2
sm:px-0
relative
text-gray-700
text-sm
hidden
sm:block
w-1
bg-blue-300
absolute
h-full
left-1/2
mt-6
sm:mt-0
sm:mb-12
sm:flex-row
justify-start
mx-auto
sm:w-1/2
sm:pr-8
p-4
bg-white
border-white
border-4
w-8
h-8
h-5
w-5
text-white
sm:pl-8
40 steps to make a Responsive Vertical Timeline component with Tailwind CSS
Set the minimum width/height of an element using the
min-h-screen
utilities.Control the background color of an element to blue-500 using the
bg-blue-500
utilities.Control the vertical padding of an element to 1.5rem using the
py-6
utilities.Use
flex
to create a block-level flex container.Use
flex
to create a block-level flex container.Control the vertical padding of an element to 3rem at only small screen sizes using the
sm:py-12
utilities.Control the vertical padding of an element to 0.75rem using the
py-3
utilities.Set the maximum width/height of an element using the
sm:max-w-xl
utilities at only small screen sizes.Control the horizontal margin of an element to auto at only small screen sizes using the
sm:mx-auto
utilities.Use
w-full
to set an element to a 100% based width.Control the horizontal padding of an element to 0.5rem using the
px-2
utilities.Control the horizontal padding of an element to 0rem at only small screen sizes using the
sm:px-0
utilities.Use
relative
to position an element according to the normal flow of the document.Control the text color of an element to gray-700 using the
text-gray-700
utilities.Control the text color of an element to sm using the
text-sm
utilities.Use
hidden
to set an element to display: none and remove it from the page layout.Use
inline
utilities to put the element on its own line and fill its parent at only small screen sizes.Use
w-1
to set an element to a fixed width(0.25rem).Control the background color of an element to blue-300 using the
bg-blue-300
utilities.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.Use
h-full
to set an element’s height to 100% of its parent, as long as the parent has a defined height.Use the
left-1/2
utilities to set the left position of a positioned element to 1/2.Control the margin on top side of an element to 1.5rem using the
mt-6
utilities.Control the margin on top side of an element to 0rem at only small screen sizes using the
sm:mt-0
utilities.Control the margin on bottom side of an element to 3rem at only small screen sizes using the
sm:mb-12
utilities.Use
flex
to create a block-level flex container at only small screen sizes.Use
justify-start
to justify items against the start of the container’s main axis.Control the horizontal margin of an element to auto using the
mx-auto
utilities.Use
sm:w-1/2
to set an element to a fixed width(1/2) at only small screen sizes.Control the padding on right side of an element to 2rem at only small screen sizes using the
sm:pr-8
utilities.Control the padding on all sides of an element to 1rem using the
p-4
utilities.Control the background color of an element to white using the
bg-white
utilities.Control the border color of an element to white using the
border-white
utilities.Control the border color of an element to 1rem using the
border-4
utilities.Use
w-8
to set an element to a fixed width(2rem).Use
h-8
to set an element to a fixed height(2rem).Use
h-5
to set an element to a fixed height(1.25rem).Use
w-5
to set an element to a fixed width(1.25rem).Control the text color of an element to white using the
text-white
utilities.Set the left padding of the element to 2rem at only small screen sizes using the
sm:pl-8
utilities class
Conclusion
The above is a step-by-step tutorial on how to use Tailwind CSS to make a Responsive Vertical Timeline components, learn and follow along to implement your own components.