- Published on
How To Build A Testimonials block With Tailwind CSS From Scratch

- What is Tailwind CSS?
- The description of Testimonials block ui component
- Why use Tailwind CSS to make a Testimonials block ui component?
- The preview of Testimonials block ui component
- The source code of Testimonials block ui component
- How to make a Testimonials block with Tailwind CSS?
- Install tailwind css of verion 2.1.4
- All the unility class needed to make a Testimonials block component
- 56 steps to make a Testimonials block 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 Testimonials block ui component
Responsive testimonials layout
Why use Tailwind CSS to make a Testimonials block ui component?
- It can make the building process of Testimonials block ui component faster and more easily.
- Enables building complex responsive layouts and components freely.
- Minimum lines of CSS code in Testimonials block component file.
The preview of Testimonials block ui component
Free download of the Testimonials block's source code
The source code of Testimonials block ui component
<style>@import url('https://cdnjs.cloudflare.com/ajax/libs/MaterialDesign-Webfont/5.3.45/css/materialdesignicons.min.css')</style>
<div class="min-w-screen min-h-screen bg-gray-50 flex items-center justify-center py-5">
<div class="w-full bg-white border-t border-b border-gray-200 px-5 py-16 md:py-24 text-gray-800">
<div class="w-full max-w-6xl mx-auto">
<div class="text-center max-w-xl mx-auto">
<h1 class="text-6xl md:text-7xl font-bold mb-5 text-gray-600">What people <br>are saying.</h1>
<h3 class="text-xl mb-5 font-light">Lorem ipsum dolor sit amet consectetur adipisicing elit.</h3>
<div class="text-center mb-10">
<span class="inline-block w-1 h-1 rounded-full bg-indigo-500 ml-1"></span>
<span class="inline-block w-3 h-1 rounded-full bg-indigo-500 ml-1"></span>
<span class="inline-block w-40 h-1 rounded-full bg-indigo-500"></span>
<span class="inline-block w-3 h-1 rounded-full bg-indigo-500 ml-1"></span>
<span class="inline-block w-1 h-1 rounded-full bg-indigo-500 ml-1"></span>
</div>
</div>
<div class="-mx-3 md:flex items-start">
<div class="px-3 md:w-1/3">
<div class="w-full mx-auto rounded-lg bg-white border border-gray-200 p-5 text-gray-800 font-light mb-6">
<div class="w-full flex mb-4 items-center">
<div class="overflow-hidden rounded-full w-10 h-10 bg-gray-50 border border-gray-200">
<img src="https://i.pravatar.cc/100?img=1" alt="">
</div>
<div class="flex-grow pl-3">
<h6 class="font-bold text-sm uppercase text-gray-600">Kenzie Edgar.</h6>
</div>
</div>
<div class="w-full">
<p class="text-sm leading-tight"><span class="text-lg leading-none italic font-bold text-gray-400 mr-1">"</span>Lorem ipsum dolor sit amet consectetur adipisicing elit. Quos sunt ratione dolor exercitationem minima quas itaque saepe quasi architecto vel! Accusantium, vero sint recusandae cum tempora nemo commodi soluta deleniti.<span class="text-lg leading-none italic font-bold text-gray-400 ml-1">"</span></p>
</div>
</div>
<div class="w-full mx-auto rounded-lg bg-white border border-gray-200 p-5 text-gray-800 font-light mb-6">
<div class="w-full flex mb-4 items-center">
<div class="overflow-hidden rounded-full w-10 h-10 bg-gray-50 border border-gray-200">
<img src="https://i.pravatar.cc/100?img=2" alt="">
</div>
<div class="flex-grow pl-3">
<h6 class="font-bold text-sm uppercase text-gray-600">Stevie Tifft.</h6>
</div>
</div>
<div class="w-full">
<p class="text-sm leading-tight"><span class="text-lg leading-none italic font-bold text-gray-400 mr-1">"</span>Lorem ipsum, dolor sit amet, consectetur adipisicing elit. Dolore quod necessitatibus, labore sapiente, est, dignissimos ullam error ipsam sint quam tempora vel.<span class="text-lg leading-none italic font-bold text-gray-400 ml-1">"</span></p>
</div>
</div>
</div>
<div class="px-3 md:w-1/3">
<div class="w-full mx-auto rounded-lg bg-white border border-gray-200 p-5 text-gray-800 font-light mb-6">
<div class="w-full flex mb-4 items-center">
<div class="overflow-hidden rounded-full w-10 h-10 bg-gray-50 border border-gray-200">
<img src="https://i.pravatar.cc/100?img=3" alt="">
</div>
<div class="flex-grow pl-3">
<h6 class="font-bold text-sm uppercase text-gray-600">Tommie Ewart.</h6>
</div>
</div>
<div class="w-full">
<p class="text-sm leading-tight"><span class="text-lg leading-none italic font-bold text-gray-400 mr-1">"</span>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Vitae, obcaecati ullam excepturi dicta error deleniti sequi.<span class="text-lg leading-none italic font-bold text-gray-400 ml-1">"</span></p>
</div>
</div>
<div class="w-full mx-auto rounded-lg bg-white border border-gray-200 p-5 text-gray-800 font-light mb-6">
<div class="w-full flex mb-4 items-center">
<div class="overflow-hidden rounded-full w-10 h-10 bg-gray-50 border border-gray-200">
<img src="https://i.pravatar.cc/100?img=4" alt="">
</div>
<div class="flex-grow pl-3">
<h6 class="font-bold text-sm uppercase text-gray-600">Charlie Howse.</h6>
</div>
</div>
<div class="w-full">
<p class="text-sm leading-tight"><span class="text-lg leading-none italic font-bold text-gray-400 mr-1">"</span>Lorem ipsum dolor sit amet consectetur adipisicing elit. Architecto inventore voluptatum nostrum atque, corrupti, vitae esse id accusamus dignissimos neque reprehenderit natus, hic sequi itaque dicta nisi voluptatem! Culpa, iusto.<span class="text-lg leading-none italic font-bold text-gray-400 ml-1">"</span></p>
</div>
</div>
</div>
<div class="px-3 md:w-1/3">
<div class="w-full mx-auto rounded-lg bg-white border border-gray-200 p-5 text-gray-800 font-light mb-6">
<div class="w-full flex mb-4 items-center">
<div class="overflow-hidden rounded-full w-10 h-10 bg-gray-50 border border-gray-200">
<img src="https://i.pravatar.cc/100?img=5" alt="">
</div>
<div class="flex-grow pl-3">
<h6 class="font-bold text-sm uppercase text-gray-600">Nevada Herbertson.</h6>
</div>
</div>
<div class="w-full">
<p class="text-sm leading-tight"><span class="text-lg leading-none italic font-bold text-gray-400 mr-1">"</span>Lorem ipsum dolor sit amet consectetur adipisicing elit. Nobis, voluptatem porro obcaecati dicta, quibusdam sunt ipsum, laboriosam nostrum facere exercitationem pariatur deserunt tempora molestiae assumenda nesciunt alias eius? Illo, autem!<span class="text-lg leading-none italic font-bold text-gray-400 ml-1">"</span></p>
</div>
</div>
<div class="w-full mx-auto rounded-lg bg-white border border-gray-200 p-5 text-gray-800 font-light mb-6">
<div class="w-full flex mb-4 items-center">
<div class="overflow-hidden rounded-full w-10 h-10 bg-gray-50 border border-gray-200">
<img src="https://i.pravatar.cc/100?img=6" alt="">
</div>
<div class="flex-grow pl-3">
<h6 class="font-bold text-sm uppercase text-gray-600">Kris Stanton.</h6>
</div>
</div>
<div class="w-full">
<p class="text-sm leading-tight"><span class="text-lg leading-none italic font-bold text-gray-400 mr-1">"</span>Lorem ipsum dolor sit amet consectetur adipisicing elit. Voluptatem iusto, explicabo, cupiditate quas totam!<span class="text-lg leading-none italic font-bold text-gray-400 ml-1">"</span></p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- BUY ME A BEER AND HELP SUPPORT OPEN-SOURCE RESOURCES -->
<div class="flex items-end justify-end fixed bottom-0 right-0 mb-4 mr-4 z-10">
<div>
<a title="Buy me a beer" href="https://www.buymeacoffee.com/scottwindon" target="_blank" class="block w-16 h-16 rounded-full transition-all shadow hover:shadow-lg transform hover:scale-110 hover:rotate-12">
<img class="object-cover object-center w-full h-full rounded-full" src="https://i.pinimg.com/originals/60/fd/e8/60fde811b6be57094e0abc69d9c2622a.jpg"/>
</a>
</div>
</div>
How to make a Testimonials block with Tailwind CSS?
Install tailwind css of verion 2.1.4
Use the script
html tag to import the script of Tailwind CSS of the version 2.1.4
<script src="https://cdn.tailwindcss.com"></script>
All the unility class needed to make a Testimonials block component
min-w-screen
min-h-screen
bg-gray-50
flex
py-5
w-full
bg-white
border-t
border-b
border-gray-200
px-5
py-16
md:py-24
text-gray-800
max-w-6xl
mx-auto
text-center
max-w-xl
text-6xl
md:text-7xl
mb-5
text-gray-600
text-xl
mb-10
inline-block
w-1
h-1
bg-indigo-500
ml-1
w-3
w-40
-mx-3
md:flex
px-3
md:w-1/3
p-5
mb-6
mb-4
overflow-hidden
w-10
h-10
flex-grow
pl-3
text-sm
text-lg
text-gray-400
mr-1
fixed
bottom-0
right-0
mr-4
z-10
block
w-16
h-16
h-full
56 steps to make a Testimonials block component with Tailwind CSS
Set the minimum width/height of an element using the
min-w-screen
utilities.Set the minimum width/height of an element using the
min-h-screen
utilities.Control the background color of an element to gray-50 using the
bg-gray-50
utilities.Use
flex
to create a block-level flex container.Control the vertical padding of an element to 1.25rem using the
py-5
utilities.Use
w-full
to set an element to a 100% based width.Control the background color of an element to white using the
bg-white
utilities.Control the border color of an element to t using the
border-t
utilities.Control the border color of an element to b using the
border-b
utilities.Control the border color of an element to gray-200 using the
border-gray-200
utilities.Control the horizontal padding of an element to 1.25rem using the
px-5
utilities.Control the vertical padding of an element to 4rem using the
py-16
utilities.Control the vertical padding of an element to 6rem at only medium screen sizes using the
md:py-24
utilities.Control the text color of an element to gray-800 using the
text-gray-800
utilities.Set the maximum width/height of an element using the
max-w-6xl
utilities.Control the horizontal margin of an element to auto using the
mx-auto
utilities.Control the text color of an element to center using the
text-center
utilities.Set the maximum width/height of an element using the
max-w-xl
utilities.Control the text color of an element to 6xl using the
text-6xl
utilities.Control the text color of an element to 7xl at only medium screen sizes using the
md:text-7xl
utilities.Control the margin on bottom side of an element to 1.25rem using the
mb-5
utilities.Control the text color of an element to gray-600 using the
text-gray-600
utilities.Control the text color of an element to xl using the
text-xl
utilities.Control the margin on bottom side of an element to 2.5rem using the
mb-10
utilities.Use
inline-block
utilities to wrap the element to prevent the text inside from extending beyond its parent.Use
w-1
to set an element to a fixed width(0.25rem).Use
h-1
to set an element to a fixed height(0.25rem).Control the background color of an element to indigo-500 using the
bg-indigo-500
utilities.Control the margin on left side of an element to 0.25rem using the
ml-1
utilities.Use
w-3
to set an element to a fixed width(0.75rem).Use
w-40
to set an element to a fixed width(10rem).Control the horizontal margin of an element to -0.75rem using the
-mx-3
utilities.Use
flex
to create a block-level flex container at only medium screen sizes.Control the horizontal padding of an element to 0.75rem using the
px-3
utilities.Use
md:w-1/3
to set an element to a fixed width(1/3) at only medium screen sizes.Control the padding on all sides of an element to 1.25rem using the
p-5
utilities.Control the margin on bottom side of an element to 1.5rem using the
mb-6
utilities.Control the margin on bottom side of an element to 1rem using the
mb-4
utilities.Use
overflow-hidden
to clip any content within an element that overflows the bounds of that element.Use
w-10
to set an element to a fixed width(2.5rem).Use
h-10
to set an element to a fixed height(2.5rem).Use
flex
to create a block-level flex container.Set the left padding of the element to 0.75rem using the
pl-3
utilities classControl the text color of an element to sm using the
text-sm
utilities.Control the text color of an element to lg using the
text-lg
utilities.Control the text color of an element to gray-400 using the
text-gray-400
utilities.Control the margin on right side of an element to 0.25rem using the
mr-1
utilities.Use
fixed
to position an element relative to the browser window.Use the
bottom-0
utilities to set the bottom position of a positioned element to 0rem.Use the
right-0
utilities to set the right position of a positioned element to 0rem.Control the margin on right side of an element to 1rem using the
mr-4
utilities.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.Use
inline
utilities to put the element on its own line and fill its parent.Use
w-16
to set an element to a fixed width(4rem).Use
h-16
to set an element to a fixed height(4rem).Use
h-full
to set an element’s height to 100% of its parent, as long as the parent has a defined height.
Conclusion
The above is a step-by-step tutorial on how to use Tailwind CSS to make a Testimonials block components, learn and follow along to implement your own components.