Published on

How to Make A Profile Card With Tailwind CSS?

Tags
Profile Card

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 Profile Card ui component

Profile card with @connect and social buttons

Why use Tailwind CSS to make a Profile Card ui component?

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

The preview of Profile Card ui component

Free download of the Profile Card's source code

The source code of Profile Card ui component

<body class="bg-gray-300 font-sans antialiased">
    <div class="container mx-auto my-60">
        <div>

            <div class="bg-white relative shadow rounded-lg w-5/6 md:w-4/6  lg:w-3/6 xl:w-2/6 mx-auto">
                <div class="flex justify-center">
                        <img src="https://scontent.fotp3-1.fna.fbcdn.net/v/t1.6435-9/175889300_2909358829319917_899035180950984171_n.jpg?_nc_cat=107&ccb=1-5&_nc_sid=09cbfe&_nc_ohc=MaOc2WiX9w0AX_xiqmh&_nc_ht=scontent.fotp3-1.fna&oh=00_AT85mEIpqHX5yThEAWoCZCt2PAnO-SS4M0yKFm9Cjti2zg&oe=628D39CC" alt="" class="rounded-full mx-auto absolute -top-20 w-32 h-32 shadow-md border-4 border-white transition duration-200 transform hover:scale-110">
                </div>
                
                <div class="mt-16">
                    <h1 class="font-bold text-center text-3xl text-gray-900">Pantazi Software</h1>
                    <p class="text-center text-sm text-gray-400 font-medium">UI Components Factory</p>
                    <p>
                        <span>
                            
                        </span>
                    </p>
                    <div class="my-5 px-6">
                        <a href="#" class="text-gray-200 block rounded-lg text-center font-medium leading-6 px-6 py-3 bg-gray-900 hover:bg-black hover:text-white">Connect with <span class="font-bold">@pantazisoft</span></a>
                    </div>
                    <div class="flex justify-between items-center my-5 px-6">
                        <a href="" class="text-gray-500 hover:text-gray-900 hover:bg-gray-100 rounded transition duration-150 ease-in font-medium text-sm text-center w-full py-3">Facebook</a>
                        <a href="" class="text-gray-500 hover:text-gray-900 hover:bg-gray-100 rounded transition duration-150 ease-in font-medium text-sm text-center w-full py-3">Twitter</a>
                        <a href="" class="text-gray-500 hover:text-gray-900 hover:bg-gray-100 rounded transition duration-150 ease-in font-medium text-sm text-center w-full py-3">Instagram</a>
                        <a href="" class="text-gray-500 hover:text-gray-900 hover:bg-gray-100 rounded transition duration-150 ease-in font-medium text-sm text-center w-full py-3">Email</a>
                    </div>

                    <div class="w-full">
                        <h3 class="font-medium text-gray-900 text-left px-6">Recent activites</h3>
                        <div class="mt-5 w-full flex flex-col items-center overflow-hidden text-sm">
                            <a href="#" class="w-full border-t border-gray-100 text-gray-600 py-4 pl-6 pr-3 w-full block hover:bg-gray-100 transition duration-150">
                                <img src="https://scontent.fotp3-1.fna.fbcdn.net/v/t1.6435-9/175889300_2909358829319917_899035180950984171_n.jpg?_nc_cat=107&ccb=1-5&_nc_sid=09cbfe&_nc_ohc=MaOc2WiX9w0AX_xiqmh&_nc_ht=scontent.fotp3-1.fna&oh=00_AT85mEIpqHX5yThEAWoCZCt2PAnO-SS4M0yKFm9Cjti2zg&oe=628D39CC" alt="" class="rounded-full h-6 shadow-md inline-block mr-2">
                                    Updated his status
                                    <span class="text-gray-500 text-xs">24 min ago</span>
                            </a>

                            <a href="#" class="w-full border-t border-gray-100 text-gray-600 py-4 pl-6 pr-3 w-full block hover:bg-gray-100 transition duration-150">
                                <img src="https://scontent.fotp3-1.fna.fbcdn.net/v/t1.6435-9/175889300_2909358829319917_899035180950984171_n.jpg?_nc_cat=107&ccb=1-5&_nc_sid=09cbfe&_nc_ohc=MaOc2WiX9w0AX_xiqmh&_nc_ht=scontent.fotp3-1.fna&oh=00_AT85mEIpqHX5yThEAWoCZCt2PAnO-SS4M0yKFm9Cjti2zg&oe=628D39CC" alt="" class="rounded-full h-6 shadow-md inline-block mr-2">
                                    Added new profile picture
                                    <span class="text-gray-500 text-xs">42 min ago</span>
                            </a>

                            <a href="#" class="w-full border-t border-gray-100 text-gray-600 py-4 pl-6 pr-3 w-full block hover:bg-gray-100 transition duration-150">
                                <img src="https://scontent.fotp3-1.fna.fbcdn.net/v/t1.6435-9/175889300_2909358829319917_899035180950984171_n.jpg?_nc_cat=107&ccb=1-5&_nc_sid=09cbfe&_nc_ohc=MaOc2WiX9w0AX_xiqmh&_nc_ht=scontent.fotp3-1.fna&oh=00_AT85mEIpqHX5yThEAWoCZCt2PAnO-SS4M0yKFm9Cjti2zg&oe=628D39CC" alt="" class="rounded-full h-6 shadow-md inline-block mr-2">
                                Posted new article in <span class="font-bold">#Web Dev</span>
                                <span class="text-gray-500 text-xs">49 min ago</span>
                            </a>

                            <a href="#" class="w-full border-t border-gray-100 text-gray-600 py-4 pl-6 pr-3 w-full block hover:bg-gray-100 transition duration-150">
                                <img src="https://scontent.fotp3-1.fna.fbcdn.net/v/t1.6435-9/175889300_2909358829319917_899035180950984171_n.jpg?_nc_cat=107&ccb=1-5&_nc_sid=09cbfe&_nc_ohc=MaOc2WiX9w0AX_xiqmh&_nc_ht=scontent.fotp3-1.fna&oh=00_AT85mEIpqHX5yThEAWoCZCt2PAnO-SS4M0yKFm9Cjti2zg&oe=628D39CC" alt="" class="rounded-full h-6 shadow-md inline-block mr-2">
                                Edited website settings
                                <span class="text-gray-500 text-xs">1 day ago</span>
                            </a>

                            <a href="#" class="w-full border-t border-gray-100 text-gray-600 py-4 pl-6 pr-3 w-full block hover:bg-gray-100 transition duration-150 overflow-hidden">
                                <img src="https://scontent.fotp3-1.fna.fbcdn.net/v/t1.6435-9/175889300_2909358829319917_899035180950984171_n.jpg?_nc_cat=107&ccb=1-5&_nc_sid=09cbfe&_nc_ohc=MaOc2WiX9w0AX_xiqmh&_nc_ht=scontent.fotp3-1.fna&oh=00_AT85mEIpqHX5yThEAWoCZCt2PAnO-SS4M0yKFm9Cjti2zg&oe=628D39CC" alt="" class="rounded-full h-6 shadow-md inline-block mr-2">
                                Added new rank
                                <span class="text-gray-500 text-xs">5 days ago</span>
                            </a>
                            
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </div>
</body>
</html>

How to make a Profile Card 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 make a Profile Card component

  • bg-gray-300
  • mx-auto
  • my-60
  • bg-white
  • relative
  • w-5/6
  • md:w-4/6
  • lg:w-3/6
  • xl:w-2/6
  • flex
  • absolute
  • -top-20
  • w-32
  • h-32
  • border-4
  • border-white
  • mt-16
  • text-center
  • text-3xl
  • text-gray-900
  • text-sm
  • text-gray-400
  • my-5
  • px-6
  • text-gray-200
  • block
  • py-3
  • bg-gray-900
  • hover:bg-black
  • hover:text-white
  • text-gray-500
  • hover:text-gray-900
  • hover:bg-gray-100
  • w-full
  • text-left
  • mt-5
  • flex-col
  • overflow-hidden
  • border-t
  • border-gray-100
  • text-gray-600
  • py-4
  • pl-6
  • pr-3
  • h-6
  • inline-block
  • mr-2
  • text-xs

48 steps to make a Profile Card component with Tailwind CSS

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

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

  3. Control the vertical margin of an element to 15rem using the my-60 utilities.

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

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

  6. Use w-5/6 to set an element to a fixed width(5/6).

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

  8. Use lg:w-3/6 to set an element to a fixed width(3/6) at only large screen sizes.

  9. Use xl:w-2/6 to set an element to a fixed width(2/6) at only extremely large screen sizes.

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

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

  12. Use the -top-20 utilities to set the top position of a positioned element to -5rem.

  13. Use w-32 to set an element to a fixed width(8rem).

  14. Use h-32 to set an element to a fixed height(8rem).

  15. Control the border color of an element to 1rem using the border-4 utilities.

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

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

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

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

  20. Control the text color of an element to gray-900 using the text-gray-900 utilities.

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

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

  23. Control the vertical margin of an element to 1.25rem using the my-5 utilities.

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

  25. Control the text color of an element to gray-200 using the text-gray-200 utilities.

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

  27. Control the vertical padding of an element to 0.75rem using the py-3 utilities.

  28. Control the background color of an element to gray-900 using the bg-gray-900 utilities.

  29. Control the background color of an element to black using the hover:bg-black utilities on hover.

  30. Control the text color of an element to white on hover using the hover:text-white utilities.

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

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

  33. Control the background color of an element to gray-100 using the hover:bg-gray-100 utilities on hover.

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

  35. Control the text color of an element to left using the text-left utilities.

  36. Control the margin on top side of an element to 1.25rem using the mt-5 utilities.

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

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

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

  40. Control the border color of an element to gray-100 using the border-gray-100 utilities.

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

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

  43. Adjust the left padding of an element to 1.5rem using the pl-6 utilities class

  44. Control the padding on right side of an element to 0.75rem using the pr-3 utilities.

  45. Use h-6 to set an element to a fixed height(1.5rem).

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

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

  48. Control the text color of an element to xs using the text-xs utilities.

Conclusion

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