Published on

How To Build A Testimonials block With Tailwind CSS From Scratch

Tags
Testimonials block

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

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

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

  3. Control the background color of an element to gray-50 using the bg-gray-50 utilities.

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

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

  6. Use w-full to set an element to a 100% based width.

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

  8. Control the border color of an element to t using the border-t utilities.

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

  10. Control the border color of an element to gray-200 using the border-gray-200 utilities.

  11. Control the horizontal padding of an element to 1.25rem using the px-5 utilities.

  12. Control the vertical padding of an element to 4rem using the py-16 utilities.

  13. Control the vertical padding of an element to 6rem at only medium screen sizes using the md:py-24 utilities.

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

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

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

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

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

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

  20. Control the text color of an element to 7xl at only medium screen sizes using the md:text-7xl utilities.

  21. Control the margin on bottom side of an element to 1.25rem using the mb-5 utilities.

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

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

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

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

  26. Use w-1 to set an element to a fixed width(0.25rem).

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

  28. Control the background color of an element to indigo-500 using the bg-indigo-500 utilities.

  29. Control the margin on left side of an element to 0.25rem using the ml-1 utilities.

  30. Use w-3 to set an element to a fixed width(0.75rem).

  31. Use w-40 to set an element to a fixed width(10rem).

  32. Control the horizontal margin of an element to -0.75rem using the -mx-3 utilities.

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

  34. Control the horizontal padding of an element to 0.75rem using the px-3 utilities.

  35. Use md:w-1/3 to set an element to a fixed width(1/3) at only medium screen sizes.

  36. Control the padding on all sides of an element to 1.25rem using the p-5 utilities.

  37. Control the margin on bottom side of an element to 1.5rem using the mb-6 utilities.

  38. Control the margin on bottom side of an element to 1rem using the mb-4 utilities.

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

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

  41. Use h-10 to set an element to a fixed height(2.5rem).

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

  43. Set the left padding of the element to 0.75rem using the pl-3 utilities class

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

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

  46. Control the text color of an element to gray-400 using the text-gray-400 utilities.

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

  48. Use fixed to position an element relative to the browser window.

  49. Use the bottom-0 utilities to set the bottom position of a positioned element to 0rem.

  50. Use the right-0 utilities to set the right position of a positioned element to 0rem.

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

  52. 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.

  53. Use inline utilities to put the element on its own line and fill its parent.

  54. Use w-16 to set an element to a fixed width(4rem).

  55. Use h-16 to set an element to a fixed height(4rem).

  56. 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.