- Published on
6 Easy Ways To Make A Emotion Dialog Card With Tailwind CSS

- What is Tailwind CSS?
- The description of Emotion Dialog Card ui component
- Why use Tailwind CSS to build a Emotion Dialog Card ui component?
- The preview of Emotion Dialog Card ui component
- The source code of Emotion Dialog Card ui component
- How to build a Emotion Dialog Card with Tailwind CSS?
- Install tailwind css of verion 2.0.1
- All the unility class needed to build a Emotion Dialog Card component
- 32 steps to build a Emotion Dialog Card 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 Emotion Dialog Card ui component
Pink with top-border
Why use Tailwind CSS to build a Emotion Dialog Card ui component?
- It can make the building process of Emotion Dialog Card ui component faster and more easily.
- Enables building complex responsive layouts and components freely.
- Minimum lines of CSS code in Emotion Dialog Card component file.
The preview of Emotion Dialog Card ui component
Free download of the Emotion Dialog Card's source code
The source code of Emotion Dialog Card ui component
<div class="min-h-screen bg-gradient-to-b from-pink-100 to-pink-400 flex justify-center items-center">
<div class="bg-white rounded-lg">
<div class="w-96 border-t-8 border-pink-600 rounded-lg flex">
<div class="w-1/3 pt-6 flex justify-center">
<svg xmlns="http://www.w3.org/2000/svg" class="w-16 h-16 bg-pink-600 text-white p-3 rounded-full" fill="none" viewBox="0 0 24 24" height="24" width="24" xmlns="http://www.w3.org/2000/svg">
<path xmlns="http://www.w3.org/2000/svg" d="M12 4.52765C9.64418 2.41689 6.02125 2.49347 3.75736 4.75736C1.41421 7.1005 1.41421 10.8995 3.75736 13.2426L10.5858 20.0711C11.3668 20.8521 12.6332 20.8521 13.4142 20.0711L20.2426 13.2426C22.5858 10.8995 22.5858 7.1005 20.2426 4.75736C17.9787 2.49347 14.3558 2.41689 12 4.52765ZM10.8284 6.17157L11.2929 6.63604C11.6834 7.02656 12.3166 7.02656 12.7071 6.63604L13.1716 6.17157C14.7337 4.60948 17.2663 4.60948 18.8284 6.17157C20.3905 7.73367 20.3905 10.2663 18.8284 11.8284L12 18.6569L5.17157 11.8284C3.60948 10.2663 3.60948 7.73367 5.17157 6.17157C6.73367 4.60948 9.26633 4.60948 10.8284 6.17157Z" fill="currentcolor"></path>
</svg>
</div>
<div class="w-full pt-9 pr-4">
<h3 class="font-bold text-pink-700">Delete Feelings?</h3>
<p class="py-4 text-sm text-gray-400">Are you sure you want to delete all feelings? If you delete your feelings, you will permantly loose everything.</p>
</div>
</div>
<div class="p-4 flex space-x-4">
<a href="#" class="w-1/2 px-4 py-3 text-center bg-gray-100 text-gray-400 hover:bg-gray-200 hover:text-black font-bold rounded-lg text-sm">Cancel</a>
<a href="#" class="w-1/2 px-4 py-3 text-center text-pink-100 bg-pink-600 rounded-lg hover:bg-pink-700 hover:text-white font-bold text-sm">Delete Feelings</a>
</div>
</div>
</div>
How to build a Emotion Dialog Card with Tailwind CSS?
Install tailwind css of verion 2.0.1
Use the script
html tag to import the script of Tailwind CSS of the version 2.0.1
<script src="https://cdn.tailwindcss.com"></script>
All the unility class needed to build a Emotion Dialog Card component
min-h-screen
bg-gradient-to-b
flex
bg-white
w-96
border-t-8
border-pink-600
w-1/3
pt-6
w-16
h-16
bg-pink-600
text-white
p-3
w-full
pt-9
pr-4
text-pink-700
py-4
text-sm
text-gray-400
p-4
w-1/2
px-4
py-3
text-center
bg-gray-100
hover:bg-gray-200
hover:text-black
text-pink-100
hover:bg-pink-700
hover:text-white
32 steps to build a Emotion Dialog Card component with Tailwind CSS
Set the minimum width/height of an element using the
min-h-screen
utilities.Control the background color of an element to gradient-to-b using the
bg-gradient-to-b
utilities.Use
flex
to create a block-level flex container.Control the background color of an element to white using the
bg-white
utilities.Use
w-96
to set an element to a fixed width(24rem).Control the border color of an element to t-8 using the
border-t-8
utilities.Control the border color of an element to pink-600 using the
border-pink-600
utilities.Use
w-1/3
to set an element to a fixed width(1/3).Control the padding on top side of an element to 1.5rem using the
pt-6
utilities.Use
w-16
to set an element to a fixed width(4rem).Use
h-16
to set an element to a fixed height(4rem).Control the background color of an element to pink-600 using the
bg-pink-600
utilities.Control the text color of an element to white using the
text-white
utilities.Control the padding on all sides of an element to 0.75rem using the
p-3
utilities.Use
w-full
to set an element to a 100% based width.Control the padding on top side of an element to 2.25rem using the
pt-9
utilities.Control the padding on right side of an element to 1rem using the
pr-4
utilities.Control the text color of an element to pink-700 using the
text-pink-700
utilities.Control the vertical padding of an element to 1rem using the
py-4
utilities.Control the text color of an element to sm using the
text-sm
utilities.Control the text color of an element to gray-400 using the
text-gray-400
utilities.Control the padding on all sides of an element to 1rem using the
p-4
utilities.Use
w-1/2
to set an element to a fixed width(1/2).Control the horizontal padding of an element to 1rem using the
px-4
utilities.Control the vertical padding of an element to 0.75rem using the
py-3
utilities.Control the text color of an element to center using the
text-center
utilities.Control the background color of an element to gray-100 using the
bg-gray-100
utilities.Control the background color of an element to gray-200 using the
hover:bg-gray-200
utilities on hover.Control the text color of an element to black on hover using the
hover:text-black
utilities.Control the text color of an element to pink-100 using the
text-pink-100
utilities.Control the background color of an element to pink-700 using the
hover:bg-pink-700
utilities on hover.Control the text color of an element to white on hover using the
hover:text-white
utilities.
Conclusion
The above is a step-by-step tutorial on how to use Tailwind CSS to build a Emotion Dialog Card components, learn and follow along to implement your own components.