- Published on
Beginners Guide: Make A Hero Message With Tailwind CSS

- What is Tailwind CSS?
- The description of Hero message ui component
- Why use Tailwind CSS to build a Hero message ui component?
- The preview of Hero message ui component
- The source code of Hero message ui component
- How to build a Hero message with Tailwind CSS?
- Install tailwind css of verion 1.3.4
- All the unility class needed to build a Hero message component
- 18 steps to build a Hero message 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 Hero message ui component
Join us hero message
Why use Tailwind CSS to build a Hero message ui component?
- It can make the building process of Hero message ui component faster and more easily.
- Enables building complex responsive layouts and components freely.
- Minimum lines of CSS code in Hero message component file.
The preview of Hero message ui component
Free download of the Hero message's source code
The source code of Hero message ui component
<div class="flex bg-gray-100 py-24 justify-center">
<div class="p-12 text-center max-w-2xl">
<div class="md:text-3xl text-3xl font-bold">Want to discover more ?</div>
<div class="text-xl font-normal mt-4">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor.
</div>
<div class="mt-6 flex justify-center h-12 relative">
<div class="flex shadow-md font-medium absolute py-2 px-4 text-green-100
cursor-pointer bg-green-600 rounded text-lg tr-mt svelte-jqwywd">Join us now</div>
</div>
</div>
</div>
How to build a Hero message with Tailwind CSS?
Install tailwind css of verion 1.3.4
Use the link
html tag to import the stylesheet of Tailwind CSS of the version 1.3.4
<link href=https://unpkg.com/[email protected]/dist/tailwind.min.css rel="stylesheet">
All the unility class needed to build a Hero message component
flex
bg-gray-100
py-24
p-12
text-center
max-w-2xl
md:text-3xl
text-3xl
text-xl
mt-4
mt-6
h-12
relative
absolute
py-2
px-4
bg-green-600
text-lg
18 steps to build a Hero message component with Tailwind CSS
Use
flex
to create a block-level flex container.Control the background color of an element to gray-100 using the
bg-gray-100
utilities.Control the vertical padding of an element to 6rem using the
py-24
utilities.Control the padding on all sides of an element to 3rem using the
p-12
utilities.Control the text color of an element to center using the
text-center
utilities.Set the maximum width/height of an element using the
max-w-2xl
utilities.Control the text color of an element to 3xl at only medium screen sizes using the
md:text-3xl
utilities.Control the text color of an element to 3xl using the
text-3xl
utilities.Control the text color of an element to xl using the
text-xl
utilities.Control the margin on top side of an element to 1rem using the
mt-4
utilities.Control the margin on top side of an element to 1.5rem using the
mt-6
utilities.Use
h-12
to set an element to a fixed height(3rem).Use
relative
to position an element according to the normal flow of the document.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.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 background color of an element to green-600 using the
bg-green-600
utilities.Control the text color of an element to lg using the
text-lg
utilities.
Conclusion
The above is a step-by-step tutorial on how to use Tailwind CSS to build a Hero message components, learn and follow along to implement your own components.