- Published on
How to Make A Label/Badges With Tailwind CSS?

- What is Tailwind CSS?
- The description of Label/Badges ui component
- Why use Tailwind CSS to build a Label/Badges ui component?
- The preview of Label/Badges ui component
- The source code of Label/Badges ui component
- How to build a Label/Badges with Tailwind CSS?
- Install tailwind css of verion 3.0.18
- All the unility class needed to build a Label/Badges component
- 37 steps to build a Label/Badges 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 Label/Badges ui component
Responsive tag/label/badges with icons
Why use Tailwind CSS to build a Label/Badges ui component?
- It can make the building process of Label/Badges ui component faster and more easily.
- Enables building complex responsive layouts and components freely.
- Minimum lines of CSS code in Label/Badges component file.
The preview of Label/Badges ui component
Free download of the Label/Badges's source code
The source code of Label/Badges ui component
<!-- MDI Icons -->
<link rel="stylesheet" href="//cdn.materialdesignicons.com/6.5.95/css/materialdesignicons.min.css">
<div class="flex items-center justify-center min-h-screen">
<div class="flex flex-col">
<div class="flex">
<span class="text-center font-bold my-20 mx-auto">
Label Badge icons required MDI (npm i @mdi/font)
<hr class="my-4">
<a href="https://egoistdeveloper.github.io/twcss-to-sass-playground/" target="_blank" class="text-blue-600">
Convetert to SASS
</a>
</span>
</div>
<div class="flex flex-col mb-14">
<h1 class="text-left font-semibold text-2xl mb-3">
Rounded Badges
</h1>
<!-- One Color Badges -->
<div class="container">
<!-- Black Label -->
<a href="#" class="inline-block rounded-full text-white
bg-black hover:bg-gray-500 duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
Black Label
</a>
<!-- Red Label -->
<a href="#" class="inline-block rounded-full text-white
bg-red-400 hover:bg-red-500 duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
Red Label
</a>
<!-- Yellow Label -->
<a href="#" class="inline-block rounded-full text-white
bg-yellow-400 hover:bg-yellow-500 duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
Yellow Label
</a>
<!-- Green Label -->
<a href="#" class="inline-block rounded-full text-white
bg-green-400 hover:bg-green-500 duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
Green Label
</a>
<!-- Blue Label -->
<a href="#" class="inline-block rounded-full text-white
bg-blue-400 hover:bg-blue-500 duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
Blue Label
</a>
<!-- Purple Label -->
<a href="#" class="inline-block rounded-full text-white
bg-purple-400 hover:bg-purple-500 duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
Purple Label
</a>
<!-- Pink Label -->
<a href="#" class="inline-block rounded-full text-white
bg-pink-400 hover:bg-pink-500 duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
Pink Label
</a>
</div>
<!-- Gradient Badges -->
<div class="container">
<!-- Black Label -->
<a href="#" class="inline-block rounded-full text-white
bg-gradient-to-br from-gray-400 to-black
hover:from-gray-400 hover:to-black
duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
Black Label
</a>
<!-- Red Label -->
<a href="#" class="inline-block rounded-full text-white
bg-gradient-to-br from-red-300 to-red-900
hover:from-red-300 hover:to-red-900
duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
Red Label
</a>
<!-- Yellow Label -->
<a href="#" class="inline-block rounded-full text-white
bg-gradient-to-br from-yellow-400 to-yellow-600
hover:from-yellow-400 hover:to-yellow-600
duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
Yellow Label
</a>
<!-- Green Label -->
<a href="#" class="inline-block rounded-full text-white
bg-gradient-to-br from-green-300 to-green-600
hover:from-green-300 hover:to-green-600
duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
Green Label
</a>
<!-- Blue Label -->
<a href="#" class="inline-block rounded-full text-white
bg-gradient-to-br from-blue-300 to-blue-600
hover:from-blue-300 hover:to-blue-600
duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
Blue Label
</a>
<!-- Purple Label -->
<a href="#" class="inline-block rounded-full text-white
bg-gradient-to-br from-purple-300 to-purple-600
hover:from-purple-300 hover:to-purple-600
duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
Purple Label
</a>
<!-- Pink Label -->
<a href="#" class="inline-block rounded-full text-white
bg-gradient-to-br from-pink-300 to-pink-600
hover:from-pink-300 hover:to-pink-600
duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
Pink Label
</a>
</div>
</div>
<div class="flex flex-col mb-14">
<h1 class="text-left font-semibold text-2xl mb-3">
Rounded Icon Badges
</h1>
<!-- One Color Badges -->
<div class="container">
<!-- Black Label -->
<a href="#" class="inline-block rounded-full text-white
bg-black hover:bg-gray-500 duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
<i class="mdi mdi-memory mr-2"></i>
Black Label
</a>
<!-- Red Label -->
<a href="#" class="inline-block rounded-full text-white
bg-red-400 hover:bg-red-500 duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
<i class="mdi mdi-check-all mr-2"></i>
Red Label
</a>
<!-- Yellow Label -->
<a href="#" class="inline-block rounded-full text-white
bg-yellow-400 hover:bg-yellow-500 duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
<i class="mdi mdi-cloud-outline mr-2"></i>
Yellow Label
</a>
<!-- Green Label -->
<a href="#" class="inline-block rounded-full text-white
bg-green-400 hover:bg-green-500 duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
<i class="mdi mdi-key mr-2"></i>
Green Label
</a>
<!-- Blue Label -->
<a href="#" class="inline-block rounded-full text-white
bg-blue-400 hover:bg-blue-500 duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
<i class="mdi mdi-layers-triple-outline mr-2"></i>
Blue Label
</a>
<!-- Purple Label -->
<a href="#" class="inline-block rounded-full text-white
bg-purple-400 hover:bg-purple-500 duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
<i class="mdi mdi-lightbulb-on-outline mr-2"></i>
Purple Label
</a>
<!-- Pink Label -->
<a href="#" class="inline-block rounded-full text-white
bg-pink-400 hover:bg-pink-500 duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
<i class="mdi mdi-medal-outline mr-2"></i>
Pink Label
</a>
</div>
<!-- Gradient Badges -->
<div class="container">
<!-- Black Label -->
<a href="#" class="inline-block rounded-full text-white
bg-gradient-to-br from-gray-400 to-black
hover:from-gray-400 hover:to-black
duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
<i class="mdi mdi-memory mr-2"></i>
Black Label
</a>
<!-- Red Label -->
<a href="#" class="inline-block rounded-full text-white
bg-gradient-to-br from-red-300 to-red-900
hover:from-red-300 hover:to-red-900
duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
<i class="mdi mdi-check-all mr-2"></i>
Red Label
</a>
<!-- Yellow Label -->
<a href="#" class="inline-block rounded-full text-white
bg-gradient-to-br from-yellow-400 to-yellow-600
hover:from-yellow-400 hover:to-yellow-600
duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
<i class="mdi mdi-cloud-outline mr-2"></i>
Yellow Label
</a>
<!-- Green Label -->
<a href="#" class="inline-block rounded-full text-white
bg-gradient-to-br from-green-300 to-green-600
hover:from-green-300 hover:to-green-600
duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
<i class="mdi mdi-key mr-2"></i>
Green Label
</a>
<!-- Blue Label -->
<a href="#" class="inline-block rounded-full text-white
bg-gradient-to-br from-blue-300 to-blue-600
hover:from-blue-300 hover:to-blue-600
duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
<i class="mdi mdi-layers-triple-outline mr-2"></i>
Blue Label
</a>
<!-- Purple Label -->
<a href="#" class="inline-block rounded-full text-white
bg-gradient-to-br from-purple-300 to-purple-600
hover:from-purple-300 hover:to-purple-600
duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
<i class="mdi mdi-lightbulb-on-outline mr-2"></i>
Purple Label
</a>
<!-- Pink Label -->
<a href="#" class="inline-block rounded-full text-white
bg-gradient-to-br from-pink-300 to-pink-600
hover:from-pink-300 hover:to-pink-600
duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
<i class="mdi mdi-medal-outline mr-2"></i>
Pink Label
</a>
</div>
</div>
<div class="flex flex-col mb-14">
<h1 class="text-left font-semibold text-2xl mb-3">
Regular Badges
</h1>
<!-- One Color Badges -->
<div class="container">
<!-- Black Label -->
<a href="#" class="inline-block rounded-sm text-white
bg-black hover:bg-gray-500 duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
Black Label
</a>
<!-- Red Label -->
<a href="#" class="inline-block rounded-sm text-white
bg-red-400 hover:bg-red-500 duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
Red Label
</a>
<!-- Yellow Label -->
<a href="#" class="inline-block rounded-sm text-white
bg-yellow-400 hover:bg-yellow-500 duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
Yellow Label
</a>
<!-- Green Label -->
<a href="#" class="inline-block rounded-sm text-white
bg-green-400 hover:bg-green-500 duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
Green Label
</a>
<!-- Blue Label -->
<a href="#" class="inline-block rounded-sm text-white
bg-blue-400 hover:bg-blue-500 duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
Blue Label
</a>
<!-- Purple Label -->
<a href="#" class="inline-block rounded-sm text-white
bg-purple-400 hover:bg-purple-500 duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
Purple Label
</a>
<!-- Pink Label -->
<a href="#" class="inline-block rounded-sm text-white
bg-pink-400 hover:bg-pink-500 duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
Pink Label
</a>
</div>
<!-- Gradient Badges -->
<div class="container">
<!-- Black Label -->
<a href="#" class="inline-block rounded-sm text-white
bg-gradient-to-br from-gray-400 to-black
hover:from-gray-400 hover:to-black
duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
Black Label
</a>
<!-- Red Label -->
<a href="#" class="inline-block rounded-sm text-white
bg-gradient-to-br from-red-300 to-red-900
hover:from-red-300 hover:to-red-900
duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
Red Label
</a>
<!-- Yellow Label -->
<a href="#" class="inline-block rounded-sm text-white
bg-gradient-to-br from-yellow-400 to-yellow-600
hover:from-yellow-400 hover:to-yellow-600
duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
Yellow Label
</a>
<!-- Green Label -->
<a href="#" class="inline-block rounded-sm text-white
bg-gradient-to-br from-green-300 to-green-600
hover:from-green-300 hover:to-green-600
duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
Green Label
</a>
<!-- Blue Label -->
<a href="#" class="inline-block rounded-sm text-white
bg-gradient-to-br from-blue-300 to-blue-600
hover:from-blue-300 hover:to-blue-600
duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
Blue Label
</a>
<!-- Purple Label -->
<a href="#" class="inline-block rounded-sm text-white
bg-gradient-to-br from-purple-300 to-purple-600
hover:from-purple-300 hover:to-purple-600
duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
Purple Label
</a>
<!-- Pink Label -->
<a href="#" class="inline-block rounded-sm text-white
bg-gradient-to-br from-pink-300 to-pink-600
hover:from-pink-300 hover:to-pink-600
duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
Pink Label
</a>
</div>
</div>
<div class="flex flex-col mb-14">
<h1 class="text-left font-semibold text-2xl mb-3">
Regular Icon Badges
</h1>
<!-- One Color Badges -->
<div class="container">
<!-- Black Label -->
<a href="#" class="inline-block rounded-sm text-white
bg-black hover:bg-gray-500 duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
<i class="mdi mdi-memory mr-2"></i>
Black Label
</a>
<!-- Red Label -->
<a href="#" class="inline-block rounded-sm text-white
bg-red-400 hover:bg-red-500 duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
<i class="mdi mdi-check-all mr-2"></i>
Red Label
</a>
<!-- Yellow Label -->
<a href="#" class="inline-block rounded-sm text-white
bg-yellow-400 hover:bg-yellow-500 duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
<i class="mdi mdi-cloud-outline mr-2"></i>
Yellow Label
</a>
<!-- Green Label -->
<a href="#" class="inline-block rounded-sm text-white
bg-green-400 hover:bg-green-500 duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
<i class="mdi mdi-key mr-2"></i>
Green Label
</a>
<!-- Blue Label -->
<a href="#" class="inline-block rounded-sm text-white
bg-blue-400 hover:bg-blue-500 duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
<i class="mdi mdi-layers-triple-outline mr-2"></i>
Blue Label
</a>
<!-- Purple Label -->
<a href="#" class="inline-block rounded-sm text-white
bg-purple-400 hover:bg-purple-500 duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
<i class="mdi mdi-lightbulb-on-outline mr-2"></i>
Purple Label
</a>
<!-- Pink Label -->
<a href="#" class="inline-block rounded-sm text-white
bg-pink-400 hover:bg-pink-500 duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
<i class="mdi mdi-medal-outline mr-2"></i>
Pink Label
</a>
</div>
<!-- Gradient Badges -->
<div class="container">
<!-- Black Label -->
<a href="#" class="inline-block rounded-sm text-white
bg-gradient-to-br from-gray-400 to-black
hover:from-gray-400 hover:to-black
duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
<i class="mdi mdi-memory mr-2"></i>
Black Label
</a>
<!-- Red Label -->
<a href="#" class="inline-block rounded-sm text-white
bg-gradient-to-br from-red-300 to-red-900
hover:from-red-300 hover:to-red-900
duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
<i class="mdi mdi-check-all mr-2"></i>
Red Label
</a>
<!-- Yellow Label -->
<a href="#" class="inline-block rounded-sm text-white
bg-gradient-to-br from-yellow-400 to-yellow-600
hover:from-yellow-400 hover:to-yellow-600
duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
<i class="mdi mdi-cloud-outline mr-2"></i>
Yellow Label
</a>
<!-- Green Label -->
<a href="#" class="inline-block rounded-sm text-white
bg-gradient-to-br from-green-300 to-green-600
hover:from-green-300 hover:to-green-600
duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
<i class="mdi mdi-key mr-2"></i>
Green Label
</a>
<!-- Blue Label -->
<a href="#" class="inline-block rounded-sm text-white
bg-gradient-to-br from-blue-300 to-blue-600
hover:from-blue-300 hover:to-blue-600
duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
<i class="mdi mdi-layers-triple-outline mr-2"></i>
Blue Label
</a>
<!-- Purple Label -->
<a href="#" class="inline-block rounded-sm text-white
bg-gradient-to-br from-purple-300 to-purple-600
hover:from-purple-300 hover:to-purple-600
duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
<i class="mdi mdi-lightbulb-on-outline mr-2"></i>
Purple Label
</a>
<!-- Pink Label -->
<a href="#" class="inline-block rounded-sm text-white
bg-gradient-to-br from-pink-300 to-pink-600
hover:from-pink-300 hover:to-pink-600
duration-300
text-xs font-bold
mr-1 md:mr-2 mb-2 px-2 md:px-4 py-1
opacity-90 hover:opacity-100">
<i class="mdi mdi-medal-outline mr-2"></i>
Pink Label
</a>
</div>
</div>
</div>
</div>
How to build a Label/Badges 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 build a Label/Badges component
flex
min-h-screen
flex-col
text-center
my-20
mx-auto
my-4
text-blue-600
mb-14
text-left
text-2xl
mb-3
inline-block
text-white
bg-black
hover:bg-gray-500
text-xs
mr-1
md:mr-2
mb-2
px-2
md:px-4
py-1
bg-red-400
hover:bg-red-500
bg-yellow-400
hover:bg-yellow-500
bg-green-400
hover:bg-green-500
bg-blue-400
hover:bg-blue-500
bg-purple-400
hover:bg-purple-500
bg-pink-400
hover:bg-pink-500
bg-gradient-to-br
mr-2
37 steps to build a Label/Badges component with Tailwind CSS
Use
flex
to create a block-level flex container.Set the minimum width/height of an element using the
min-h-screen
utilities.Use
flex
to create a block-level flex container.Control the text color of an element to center using the
text-center
utilities.Control the vertical margin of an element to 5rem using the
my-20
utilities.Control the horizontal margin of an element to auto using the
mx-auto
utilities.Control the vertical margin of an element to 1rem using the
my-4
utilities.Control the text color of an element to blue-600 using the
text-blue-600
utilities.Control the margin on bottom side of an element to 3.5rem using the
mb-14
utilities.Control the text color of an element to left using the
text-left
utilities.Control the text color of an element to 2xl using the
text-2xl
utilities.Control the margin on bottom side of an element to 0.75rem using the
mb-3
utilities.Use
inline-block
utilities to wrap the element to prevent the text inside from extending beyond its parent.Control the text color of an element to white using the
text-white
utilities.Control the background color of an element to black using the
bg-black
utilities.Control the background color of an element to gray-500 using the
hover:bg-gray-500
utilities on hover.Control the text color of an element to xs using the
text-xs
utilities.Control the margin on right side of an element to 0.25rem using the
mr-1
utilities.Control the margin on right side of an element to 0.5rem at only medium screen sizes using the
md:mr-2
utilities.Control the margin on bottom side of an element to 0.5rem using the
mb-2
utilities.Control the horizontal padding of an element to 0.5rem using the
px-2
utilities.Control the horizontal padding of an element to 1rem at only medium screen sizes using the
md:px-4
utilities.Control the vertical padding of an element to 0.25rem using the
py-1
utilities.Control the background color of an element to red-400 using the
bg-red-400
utilities.Control the background color of an element to red-500 using the
hover:bg-red-500
utilities on hover.Control the background color of an element to yellow-400 using the
bg-yellow-400
utilities.Control the background color of an element to yellow-500 using the
hover:bg-yellow-500
utilities on hover.Control the background color of an element to green-400 using the
bg-green-400
utilities.Control the background color of an element to green-500 using the
hover:bg-green-500
utilities on hover.Control the background color of an element to blue-400 using the
bg-blue-400
utilities.Control the background color of an element to blue-500 using the
hover:bg-blue-500
utilities on hover.Control the background color of an element to purple-400 using the
bg-purple-400
utilities.Control the background color of an element to purple-500 using the
hover:bg-purple-500
utilities on hover.Control the background color of an element to pink-400 using the
bg-pink-400
utilities.Control the background color of an element to pink-500 using the
hover:bg-pink-500
utilities on hover.Control the background color of an element to gradient-to-br using the
bg-gradient-to-br
utilities.Control the margin on right side of an element to 0.5rem using the
mr-2
utilities.
Conclusion
The above is a step-by-step tutorial on how to use Tailwind CSS to build a Label/Badges components, learn and follow along to implement your own components.