- Published on
6 Steps To Make A Simple Promotion Banner (Notification) With Tailwind CSS Like A Pro In Under An Hour

- What is Tailwind CSS?
- The description of Simple Promotion Banner (Notification) ui component
- Why use Tailwind CSS to build a Simple Promotion Banner (Notification) ui component?
- The preview of Simple Promotion Banner (Notification) ui component
- The source code of Simple Promotion Banner (Notification) ui component
- How to build a Simple Promotion Banner (Notification) with Tailwind CSS?
- Install tailwind css of verion 2.2.4
- All the unility class needed to build a Simple Promotion Banner (Notification) component
- 22 steps to build a Simple Promotion Banner (Notification) 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 Promotion Banner (Notification) ui component
A simple notification banner to promote whatever you need.
Why use Tailwind CSS to build a Simple Promotion Banner (Notification) ui component?
- It can make the building process of Simple Promotion Banner (Notification) ui component faster and more easily.
- Enables building complex responsive layouts and components freely.
- Minimum lines of CSS code in Simple Promotion Banner (Notification) component file.
The preview of Simple Promotion Banner (Notification) ui component
Free download of the Simple Promotion Banner (Notification)'s source code
The source code of Simple Promotion Banner (Notification) ui component
<link href="https://use.fontawesome.com/releases/v5.10.2/css/all.css" rel="stylesheet" />
<div>
<div
class="text-center flex flex-col p-4 md:text-left md:flex-row md:items-center md:justify-between md:p-4 bg-purple-100"
id="messageModal"
>
<div class="text-xl font-semibold">
<div class="text-gray-900">
Some interesting header.
<b class="text-purple-500">Some secondary text</b>
</div>
</div>
<div class="mt-3 md:mt-0 md:ml-2">
<button
class="inline-block rounded-md text-lg font-semibold py-2 px-4 text-white bg-purple-500"
onclick="window.open('https://google.com')"
>
<i class="fas fa-user"></i> Some Button
</button>
<button
class="inline-block rounded-md text-lg font-semibold py-2 px-4 text-black bg-gray-300"
onclick="document.getElementById('messageModal').style.display = 'none'"
>
<i class="fas fa-times"></i>
</button>
</div>
</div>
</div>
How to build a Simple Promotion Banner (Notification) with Tailwind CSS?
Install tailwind css of verion 2.2.4
Use the script
html tag to import the script of Tailwind CSS of the version 2.2.4
<script src="https://cdn.tailwindcss.com"></script>
All the unility class needed to build a Simple Promotion Banner (Notification) component
text-center
flex
flex-col
p-4
md:text-left
md:flex-row
md:p-4
bg-purple-100
text-xl
text-gray-900
text-purple-500
mt-3
md:mt-0
md:ml-2
inline-block
text-lg
py-2
px-4
text-white
bg-purple-500
text-black
bg-gray-300
22 steps to build a Simple Promotion Banner (Notification) component with Tailwind CSS
Control the text color of an element to center using the
text-center
utilities.Use
flex
to create a block-level flex container.Use
flex
to create a block-level flex container.Control the padding on all sides of an element to 1rem using the
p-4
utilities.Control the text color of an element to left at only medium screen sizes using the
md:text-left
utilities.Use
flex
to create a block-level flex container at only medium screen sizes.Control the padding on all sides of an element to 1rem at only medium screen sizes using the
md:p-4
utilities.Control the background color of an element to purple-100 using the
bg-purple-100
utilities.Control the text color of an element to xl using the
text-xl
utilities.Control the text color of an element to gray-900 using the
text-gray-900
utilities.Control the text color of an element to purple-500 using the
text-purple-500
utilities.Control the margin on top side of an element to 0.75rem using the
mt-3
utilities.Control the margin on top side of an element to 0rem at only medium screen sizes using the
md:mt-0
utilities.Control the margin on left side of an element to 0.5rem at only medium screen sizes using the
md:ml-2
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 lg using the
text-lg
utilities.Control the vertical padding of an element to 0.5rem using the
py-2
utilities.Control the horizontal padding of an element to 1rem using the
px-4
utilities.Control the text color of an element to white using the
text-white
utilities.Control the background color of an element to purple-500 using the
bg-purple-500
utilities.Control the text color of an element to black using the
text-black
utilities.Control the background color of an element to gray-300 using the
bg-gray-300
utilities.
Conclusion
The above is a step-by-step tutorial on how to use Tailwind CSS to build a Simple Promotion Banner (Notification) components, learn and follow along to implement your own components.