Published on

Surprisingly Effective Ways To Make A Github Profile Card With Tailwind CSS

Tags
github 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 github profile card ui component

Github profile card

Why use Tailwind CSS to build a github profile card ui component?

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

The preview of github profile card ui component

Free download of the github profile card's source code

The source code of github profile card ui component

<!-- This is an example component -->
<div>
	<div class='flex space-x-2 w-full bg-white shadow-md rounded-lg overflow-hidden mx-auto'>
		<div
			class="card  min-w-sm border border-gray-100 bg-purple-100   transition-shadow shadow-xl hover:shadow-xl min-w-max">
			<!---->
			<div class="w-full card__media"><img src="https://image.freepik.com/free-vector/abstract-binary-code-techno-background_1048-12836.jpg" class="h-48 w-96"></div>
				<div class="  card__media--aside "></div>
				<div class="flex items-center p-4">
					<div class="relative flex flex-col items-center w-full">
						<div
							class="h-24 w-24 md rounded-full relative avatar flex items-end justify-end text-purple-600 min-w-max absolute -top-16 flex bg-purple-200 text-purple-100 row-start-1 row-end-3 text-purple-650 ring-1 ring-white">
							<img class="h-24 w-24 md rounded-full relative" src="https://avatars3.githubusercontent.com/u/11801238?v=4" alt="">
							<div class="absolute"></div>
						</div>
						<div class="flex flex-col space-y-1 justify-center items-center -mt-12 w-full">
							<span class="text-md whitespace-nowrap text-gray-800 font-semibold">Brahim</span><span class="text-md whitespace-nowrap text-gray-600">boussadjra</span>
							<p class="text-sm text-gray-500">
								I can't start my day without a coffee cup
							</p>
							<div class="py-2 flex space-x-2">
								<button class="flex justify-center  max-h-max whitespace-nowrap focus:outline-none  focus:ring  focus:border-blue-300 rounded max-w-max border bg-transparent border-purple-700 text-purple-700 hover:border-purple-800 hover:border-purple-800 px-4 py-1 flex items-center hover:shadow-lg"><span class="mr-2"></span>FOLLOW<span class="ml-2"></span></button><button class="flex justify-center  max-h-max whitespace-nowrap focus:outline-none  focus:ring  focus:border-blue-300 rounded max-w-max text-gray-100 bg-green-500 hover:bg-green-600 px-4 py-1 flex items-center hover:shadow-lg"><span class="mr-2"><svg height="20" width="20" viewBox="0 0 32 32" class="fill-current text-red-100"><path d="M22.5,4c-2,0-3.9,0.8-5.3,2.2L16,7.4l-1.1-1.1C12,3.3,7.2,3.3,4.3,6.2c0,0-0.1,0.1-0.1,0.1c-3,3-3,7.8,0,10.8L16,29	l11.8-11.9c3-3,3-7.8,0-10.8C26.4,4.8,24.5,4,22.5,4z"></path></svg></span>SPONSOR <span class="ml-2"></span></button>
							</div>
							<div
								class="py-4 flex justify-center items-center w-full divide-x divide-gray-400 divide-solid">
								<span class="text-center px-2"><span class="font-bold text-gray-700">56</span><span class="text-gray-600"> followers</span></span><span class="text-center px-2"><span class="font-bold text-gray-700">112</span><span class="text-gray-600"> following</span></span><span class="text-center px-2"><span class="font-bold text-gray-700">27</span><span class="text-gray-600"> repos</span></span>
							</div>
						</div>
					</div>
				</div>
				<!---->
			</div>
			<!---->
			<!---->
			<!---->
				<div
			class="card  min-w-sm border border-gray-700 bg-gray-700 text-gray-50   transition-shadow shadow-xl hover:shadow-xl min-w-max">
			<!---->
			<div class="w-full card__media"><img src="https://image.freepik.com/free-vector/abstract-binary-code-techno-background_1048-12836.jpg" class="h-48 w-96"></div>
			
				<div class="flex items-center p-4">
					<div class="relative flex flex-col items-center w-full">
						<div
							class="h-24 w-24 md rounded-full relative avatar flex items-end justify-end text-purple-400 min-w-max absolute -top-16 flex bg-purple-200 text-purple-100 row-start-1 row-end-3 text-purple-650 ring-1 ring-white">
							<img class="h-24 w-24 md rounded-full relative" src="https://avatars3.githubusercontent.com/u/11801238?v=4" alt="">
							<div class="absolute"></div>
						</div>
						<div class="flex flex-col space-y-1 justify-center items-center -mt-12 w-full">
							<span class="text-md whitespace-nowrap text-gray-50 font-semibold">Brahim</span><span class="text-md whitespace-nowrap text-gray-100">boussadjra</span>
							<p class="text-sm text-gray-200">
								I can't start my day without a coffee cup
							</p>
							<div class="py-2 flex space-x-2">
								<button class="flex justify-center  max-h-max whitespace-nowrap focus:outline-none  focus:ring  focus:border-blue-300 rounded max-w-max border bg-transparent border-purple-400 text-purple-400 hover:border-purple-800 hover:border-purple-500 px-4 py-1 flex items-center hover:shadow-lg"><span class="mr-2"></span>FOLLOW<span class="ml-2"></span></button><button class="flex justify-center  max-h-max whitespace-nowrap focus:outline-none  focus:ring  focus:border-blue-300 rounded max-w-max text-gray-100 bg-green-500 hover:bg-green-600 px-4 py-1 flex items-center hover:shadow-lg"><span class="mr-2"><svg height="20" width="20" viewBox="0 0 32 32" class="fill-current text-red-100"><path d="M22.5,4c-2,0-3.9,0.8-5.3,2.2L16,7.4l-1.1-1.1C12,3.3,7.2,3.3,4.3,6.2c0,0-0.1,0.1-0.1,0.1c-3,3-3,7.8,0,10.8L16,29	l11.8-11.9c3-3,3-7.8,0-10.8C26.4,4.8,24.5,4,22.5,4z"></path></svg></span>SPONSOR <span class="ml-2"></span></button>
							</div>
							<div
								class="py-4 flex justify-center items-center w-full divide-x divide-gray-400 divide-solid">
								<span class="text-center px-2"><span class="font-bold text-gray-50">56</span><span class="text-gray-100"> followers</span></span><span class="text-center px-2"><span class="font-bold text-gray-50">112</span><span class="text-gray-100"> following</span></span><span class="text-center px-2"><span class="font-bold text-gray-50">27</span><span class="text-gray-100"> repos</span></span>
							</div>
						</div>
					</div>
				</div>
				<!---->
			</div>
		</div>
	</div>

How to build a github profile card with Tailwind CSS?

Install tailwind css of verion 2.0.2

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

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

All the unility class needed to build a github profile card component

  • min-w-sm
  • border-gray-100
  • bg-purple-100
  • min-w-max
  • w-full
  • h-48
  • w-96
  • flex
  • p-4
  • relative
  • flex-col
  • h-24
  • w-24
  • text-purple-600
  • absolute
  • -top-16
  • bg-purple-200
  • text-purple-100
  • text-purple-650
  • -mt-12
  • text-md
  • text-gray-800
  • text-gray-600
  • text-sm
  • text-gray-500
  • py-2
  • max-h-max
  • focus:border-blue-300
  • max-w-max
  • bg-transparent
  • border-purple-700
  • text-purple-700
  • hover:border-purple-800
  • px-4
  • py-1
  • mr-2
  • ml-2
  • text-gray-100
  • bg-green-500
  • hover:bg-green-600
  • text-red-100
  • py-4
  • text-center
  • px-2
  • text-gray-700
  • border-gray-700
  • bg-gray-700
  • text-gray-50
  • text-purple-400
  • text-gray-200
  • border-purple-400
  • hover:border-purple-500

52 steps to build a github profile card component with Tailwind CSS

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

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

  3. Control the background color of an element to purple-100 using the bg-purple-100 utilities.

  4. Set the minimum width/height of an element using the min-w-max utilities.

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

  6. Use h-48 to set an element to a fixed height(12rem).

  7. Use w-96 to set an element to a fixed width(24rem).

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

  9. Control the padding on all sides of an element to 1rem using the p-4 utilities.

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

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

  12. Use h-24 to set an element to a fixed height(6rem).

  13. Use w-24 to set an element to a fixed width(6rem).

  14. Control the text color of an element to purple-600 using the text-purple-600 utilities.

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

  16. Use the -top-16 utilities to set the top position of a positioned element to -4rem.

  17. Control the background color of an element to purple-200 using the bg-purple-200 utilities.

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

  19. Control the text color of an element to purple-650 using the text-purple-650 utilities.

  20. Control the margin on top side of an element to -3rem using the -mt-12 utilities.

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

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

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

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

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

  26. Control the vertical padding of an element to 0.5rem using the py-2 utilities.

  27. Set the maximum width/height of an element using the max-h-max utilities.

  28. Control the border color of an element to blue-300 using the focus:border-blue-300 utilities on focus.

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

  30. Control the background color of an element to transparent using the bg-transparent utilities.

  31. Control the border color of an element to purple-700 using the border-purple-700 utilities.

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

  33. Control the border color of an element to purple-800 using the hover:border-purple-800 utilities on hover.

  34. Control the horizontal padding of an element to 1rem using the px-4 utilities.

  35. Control the vertical padding of an element to 0.25rem using the py-1 utilities.

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

  37. Control the margin on left side of an element to 0.5rem using the ml-2 utilities.

  38. Control the text color of an element to gray-100 using the text-gray-100 utilities.

  39. Control the background color of an element to green-500 using the bg-green-500 utilities.

  40. Control the background color of an element to green-600 using the hover:bg-green-600 utilities on hover.

  41. Control the text color of an element to red-100 using the text-red-100 utilities.

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

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

  44. Control the horizontal padding of an element to 0.5rem using the px-2 utilities.

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

  46. Control the border color of an element to gray-700 using the border-gray-700 utilities.

  47. Control the background color of an element to gray-700 using the bg-gray-700 utilities.

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

  49. Control the text color of an element to purple-400 using the text-purple-400 utilities.

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

  51. Control the border color of an element to purple-400 using the border-purple-400 utilities.

  52. Control the border color of an element to purple-500 using the hover:border-purple-500 utilities on hover.

Conclusion

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