- Published on
Learn How To Make A Simple Avatar (and initials) With Tailwind CSS Like an Expert

- What is Tailwind CSS?
- The description of Simple Avatar (and initials) ui component
- Why use Tailwind CSS to make a Simple Avatar (and initials) ui component?
- The preview of Simple Avatar (and initials) ui component
- The source code of Simple Avatar (and initials) ui component
- How to make a Simple Avatar (and initials) with Tailwind CSS?
- Install tailwind css of verion 0.3.0
- All the unility class needed to make a Simple Avatar (and initials) component
- 27 steps to make a Simple Avatar (and initials) 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 Simple Avatar (and initials) ui component
Simple avatar with initials avatar on hover state can be used anywhere.
Why use Tailwind CSS to make a Simple Avatar (and initials) ui component?
- It can make the building process of Simple Avatar (and initials) ui component faster and more easily.
- Enables building complex responsive layouts and components freely.
- Minimum lines of CSS code in Simple Avatar (and initials) component file.
The preview of Simple Avatar (and initials) ui component
Free download of the Simple Avatar (and initials)'s source code
The source code of Simple Avatar (and initials) ui component
<section>
<h1 class="w-full">Avatar Component with initials (on hover)</h1>
<div class="w-10 h-10 relative mb-4">
<div class="group w-full h-full rounded-full overflow-hidden shadow-inner text-center bg-purple table cursor-pointer">
<span class="hidden group-hover:table-cell text-white font-bold align-middle">KR</span>
<img src="https://pickaface.net/gallery/avatar/unr_random_180410_1905_z1exb.png" alt="lovely avatar" class="object-cover object-center w-full h-full visible group-hover:hidden" />
</div>
</div>
<div class="w-12 h-12 relative mb-4">
<div class="group w-full h-full rounded-full overflow-hidden shadow-inner text-center bg-purple table cursor-pointer">
<span class="hidden group-hover:table-cell text-white font-bold align-middle">KR</span>
<img src="https://pickaface.net/gallery/avatar/unr_random_180410_1905_z1exb.png" alt="lovely avatar" class="object-cover object-center w-full h-full visible group-hover:hidden" />
</div>
</div>
<div class="w-16 h-16 relative mb-4">
<div class="group w-full h-full rounded-full overflow-hidden shadow-inner text-center bg-purple table cursor-pointer">
<span class="hidden group-hover:table-cell text-white font-bold align-middle">KR</span>
<img src="https://pickaface.net/gallery/avatar/unr_random_180410_1905_z1exb.png" alt="lovely avatar" class="object-cover object-center w-full h-full visible group-hover:hidden" />
</div>
</div>
<div class="w-24 h-24 relative mb-4">
<div class="group w-full h-full rounded-full overflow-hidden shadow-inner text-center bg-purple table cursor-pointer">
<span class="hidden group-hover:table-cell text-white font-bold align-middle">KR</span>
<img src="https://pickaface.net/gallery/avatar/unr_random_180410_1905_z1exb.png" alt="lovely avatar" class="object-cover object-center w-full h-full visible group-hover:hidden" />
</div>
</div>
<div class="w-32 h-32 relative mb-4">
<div class="group w-full h-full rounded-full overflow-hidden shadow-inner text-center bg-purple table cursor-pointer">
<span class="hidden group-hover:table-cell text-white font-bold align-middle">KR</span>
<img src="https://pickaface.net/gallery/avatar/unr_random_180410_1905_z1exb.png" alt="lovely avatar" class="object-cover object-center w-full h-full visible group-hover:hidden" />
</div>
</div>
<div class="w-48 h-48 relative mb-4">
<div class="group w-full h-full rounded-full overflow-hidden shadow-inner text-center bg-purple table cursor-pointer">
<span class="hidden group-hover:table-cell text-white font-bold align-middle">KR</span>
<img src="https://pickaface.net/gallery/avatar/unr_random_180410_1905_z1exb.png" alt="lovely avatar" class="object-cover object-center w-full h-full visible group-hover:hidden" />
</div>
</div>
<div class="w-64 h-64 relative mb-4">
<div class="group w-full h-full rounded-full overflow-hidden shadow-inner text-center bg-purple table cursor-pointer">
<span class="hidden group-hover:table-cell text-white font-bold align-middle">KR</span>
<img src="https://pickaface.net/gallery/avatar/unr_random_180410_1905_z1exb.png" alt="lovely avatar" class="object-cover object-center w-full h-full visible group-hover:hidden" />
</div>
</div>
</section>
How to make a Simple Avatar (and initials) with Tailwind CSS?
Install tailwind css of verion 0.3.0
Use the link
html tag to import the stylesheet of Tailwind CSS of the version 0.3.0
<link href=https://unpkg.com/[email protected]/dist/tailwind.min.css rel="stylesheet">
All the unility class needed to make a Simple Avatar (and initials) component
w-full
w-10
h-10
relative
mb-4
h-full
overflow-hidden
text-center
bg-purple
table
hidden
group-hover:table-cell
text-white
visible
group-hover:hidden
w-12
h-12
w-16
h-16
w-24
h-24
w-32
h-32
w-48
h-48
w-64
h-64
27 steps to make a Simple Avatar (and initials) component with Tailwind CSS
Use
w-full
to set an element to a 100% based width.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
relative
to position an element according to the normal flow of the document.Control the margin on bottom side of an element to 1rem using the
mb-4
utilities.Use
h-full
to set an element’s height to 100% of its parent, as long as the parent has a defined height.Use
overflow-hidden
to clip any content within an element that overflows the bounds of that element.Control the text color of an element to center using the
text-center
utilities.Control the background color of an element to purple using the
bg-purple
utilities.Use the
table
utilities to create elements that behave like their respective table elements.Use
hidden
to set an element to display: none and remove it from the page layout.Use the
table
utilities to create elements that behave like their respective table elementsundefined.Control the text color of an element to white using the
text-white
utilities.Use
visible
to make an element visible. This is mostly useful for undoing the invisible utility at different screen sizes.Use
hidden
to set an element to display: none and remove it from the page layout.Use
w-12
to set an element to a fixed width(3rem).Use
h-12
to set an element to a fixed height(3rem).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
w-24
to set an element to a fixed width(6rem).Use
h-24
to set an element to a fixed height(6rem).Use
w-32
to set an element to a fixed width(8rem).Use
h-32
to set an element to a fixed height(8rem).Use
w-48
to set an element to a fixed width(12rem).Use
h-48
to set an element to a fixed height(12rem).Use
w-64
to set an element to a fixed width(16rem).Use
h-64
to set an element to a fixed height(16rem).
Conclusion
The above is a step-by-step tutorial on how to use Tailwind CSS to make a Simple Avatar (and initials) components, learn and follow along to implement your own components.