- Published on
Here Are 6 Ways To Build A Card Hero Section With Tailwind CSS

- What is Tailwind CSS?
- The description of Card hero section ui component
- Why use Tailwind CSS to build a Card hero section ui component?
- The preview of Card hero section ui component
- The source code of Card hero section ui component
- How to build a Card hero section with Tailwind CSS?
- Install tailwind css of verion 1.9.6
- All the unility class needed to build a Card hero section component
- 75 steps to build a Card hero section 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 Card hero section ui component
Why use Tailwind CSS to build a Card hero section ui component?
- It can make the building process of Card hero section ui component faster and more easily.
- Enables building complex responsive layouts and components freely.
- Minimum lines of CSS code in Card hero section component file.
The preview of Card hero section ui component
Free download of the Card hero section's source code
The source code of Card hero section ui component
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AR | Hero Section</title>
</head>
<body>
<div class="min-h-screen min-w-full bg-gray-100 flex flex-col justify-center p-10">
<div class="relative w-full max-w-full lg:max-w-6xl xl:max-w-screen-2xl mx-auto">
<div class="absolute inset-0 -mr-3.5 bg-gradient-to-r from-red-100 to-purple-500 shadow-lg transform -skew-y-6 sm:skew-y-0 sm:rotate-3 sm:rounded-3xl"></div>
<div class="relative bg-white shadow-lg sm:rounded-3xl">
<div class="flex items-center justify-start pt-6 pl-6">
<span class="w-3 h-3 bg-red-400 rounded-full mr-2"></span>
<span class="w-3 h-3 bg-yellow-400 rounded-full mr-2"></span>
<span class="w-3 h-3 bg-green-400 rounded-full mr-2"></span>
</div>
<div class="px-20 py-6">
<!-- nav -->
<div class="flex items-center justify-between">
<div class="flex items-center justify-center">
<div class="flex items-center justify-center text-3xl font-bold text-true-gray-800">
<svg class="w-10 h-10 mr-1 text-blue-700" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M17.657 18.657A8 8 0 016.343 7.343S7 9 9 10c0-2 .5-5 2.986-7C14 5 16.09 5.777 17.656 7.343A7.975 7.975 0 0120 13a7.975 7.975 0 01-2.343 5.657z"></path>
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M9.879 16.121A3 3 0 1012.015 11L11 14H9c0 .768.293 1.536.879 2.121z"></path>
</svg>
AR
</div>
<div class="hidden lg:flex items-center justify-center antialiased lg:ml-20 pt-1">
<a href="#" class="flex items-center justify-center mr-10 text-base text-gray-700 text-opacity-90 font-medium tracking-tight hover:text-cool-gray-600 transition duration-150 ease-in-out">
Product
<svg class="w-3.5 h-4 ml-2" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="3" d="M19 9l-7 7-7-7"></path>
</svg>
</a>
<a href="#" class="flex items-center justify-center mr-10 text-base text-gray-700 text-opacity-90 font-medium tracking-tight hover:text-cool-gray-600 transition duration-150 ease-in-out">
Community
<svg class="w-3.5 h-4 ml-2" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="3" d="M19 9l-7 7-7-7"></path>
</svg>
</a>
<a href="#" class="flex items-center justify-center mr-10 text-base text-gray-700 text-opacity-90 font-medium tracking-tight hover:text-cool-gray-600 transition duration-150 ease-in-out">
Plans
</a>
</div>
</div>
<div class="hidden md:flex items-center justify-center">
<a href="#" class="mr-5 text-lg font-medium text-true-gray-800 hover:text-cool-gray-700 transition duration-150 ease-in-out">Login</a>
<button class="px-6 py-3 rounded-3xl font-medium bg-gradient-to-b from-gray-900 to-black text-white outline-none focus:outline-none hover:shadow-md hover:from-true-gray-900 transition duration-200 ease-in-out">Sign Up</button>
</div>
</div>
<!-- /nav -->
<!-- hero section -->
<div class="lg:2/6 xl:w-2/4 mt-20 lg:mt-40 lg:ml-16 text-left">
<div class="text-6xl font-semibold text-gray-900 leading-none">Bring all your work together</div>
<div class="mt-6 text-xl font-light text-true-gray-500 antialiased">A better experience for yout attendees and less stress yout team.</div>
<button class="mt-6 px-8 py-4 rounded-full font-normal tracking-wide bg-gradient-to-b from-blue-600 to-blue-700 text-white outline-none focus:outline-none hover:shadow-lg hover:from-blue-700 transition duration-200 ease-in-out">
Download for Free
</button>
</div>
<div class="mt-12 lg:mt-32 lg:ml-20 text-left">
<bottom type="button" class="flex items-center justify-center w-12 h-12 rounded-full bg-cool-gray-100 text-gray-800 animate-bounce hover:text-gray-900 hover:bg-cool-gray-50 transition duration-300 ease-in-out cursor-pointer">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M19 14l-7 7m0 0l-7-7m7 7V3"></path>
</svg>
</bottom>
</div>
<!-- /hero section -->
</div>
</div>
</div>
</div>
</body>
</html>
How to build a Card hero section with Tailwind CSS?
Install tailwind css of verion 1.9.6
Use the link
html tag to import the stylesheet of Tailwind CSS of the version 1.9.6
<link href=https://unpkg.com/[email protected]/dist/tailwind.min.css rel="stylesheet">
All the unility class needed to build a Card hero section component
min-h-screen
min-w-full
bg-gray-100
flex
flex-col
p-10
relative
w-full
max-w-full
lg:max-w-6xl
xl:max-w-screen-2xl
mx-auto
absolute
-mr-3.5
bg-gradient-to-r
bg-white
justify-start
pt-6
pl-6
w-3
h-3
bg-red-400
mr-2
bg-yellow-400
bg-green-400
px-20
py-6
text-3xl
text-true-gray-800
w-10
h-10
mr-1
text-blue-700
hidden
lg:flex
lg:ml-20
pt-1
mr-10
text-base
text-gray-700
text-opacity-90
hover:text-cool-gray-600
w-3.5
h-4
ml-2
md:flex
mr-5
text-lg
hover:text-cool-gray-700
px-6
py-3
bg-gradient-to-b
text-white
xl:w-2/4
mt-20
lg:mt-40
lg:ml-16
text-left
text-6xl
text-gray-900
mt-6
text-xl
text-true-gray-500
px-8
py-4
mt-12
lg:mt-32
w-12
h-12
bg-cool-gray-100
text-gray-800
hover:text-gray-900
hover:bg-cool-gray-50
w-6
h-6
75 steps to build a Card hero section component with Tailwind CSS
Set the minimum width/height of an element using the
min-h-screen
utilities.Set the minimum width/height of an element using the
min-w-full
utilities.Control the background color of an element to gray-100 using the
bg-gray-100
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 2.5rem using the
p-10
utilities.Use
relative
to position an element according to the normal flow of the document.Use
w-full
to set an element to a 100% based width.Set the maximum width/height of an element using the
max-w-full
utilities.Set the maximum width/height of an element using the
lg:max-w-6xl
utilities at only large screen sizes.Set the maximum width/height of an element using the
xl:max-w-screen-2xl
utilities at only extremely large screen sizes.Control the horizontal margin of an element to auto using the
mx-auto
utilities.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 margin on right side of an element to 3.5 using the
-mr-3.5
utilities.Control the background color of an element to gradient-to-r using the
bg-gradient-to-r
utilities.Control the background color of an element to white using the
bg-white
utilities.Use
justify-start
to justify items against the start of the container’s main axis.Control the padding on top side of an element to 1.5rem using the
pt-6
utilities.Set the left padding of an element to 1.5rem using the
pl-6
utilities classUse
w-3
to set an element to a fixed width(0.75rem).Use
h-3
to set an element to a fixed height(0.75rem).Control the background color of an element to red-400 using the
bg-red-400
utilities.Control the margin on right side of an element to 0.5rem using the
mr-2
utilities.Control the background color of an element to yellow-400 using the
bg-yellow-400
utilities.Control the background color of an element to green-400 using the
bg-green-400
utilities.Control the horizontal padding of an element to 5rem using the
px-20
utilities.Control the vertical padding of an element to 1.5rem using the
py-6
utilities.Control the text color of an element to 3xl using the
text-3xl
utilities.Control the text color of an element to true-gray-800 using the
text-true-gray-800
utilities.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).Control the margin on right side of an element to 0.25rem using the
mr-1
utilities.Control the text color of an element to blue-700 using the
text-blue-700
utilities.Use
hidden
to set an element to display: none and remove it from the page layout.Use
flex
to create a block-level flex container at only large screen sizes.Control the margin on left side of an element to 5rem at only large screen sizes using the
lg:ml-20
utilities.Control the padding on top side of an element to 0.25rem using the
pt-1
utilities.Control the margin on right side of an element to 2.5rem using the
mr-10
utilities.Control the text color of an element to base using the
text-base
utilities.Control the text color of an element to gray-700 using the
text-gray-700
utilities.Control the text color of an element to opacity-90 using the
text-opacity-90
utilities.Control the text color of an element to cool-gray-600 on hover using the
hover:text-cool-gray-600
utilities.Use
w-3.5
to set an element to a fixed width(3.5).Use
h-4
to set an element to a fixed height(1rem).Control the margin on left side of an element to 0.5rem using the
ml-2
utilities.Use
flex
to create a block-level flex container at only medium screen sizes.Control the margin on right side of an element to 1.25rem using the
mr-5
utilities.Control the text color of an element to lg using the
text-lg
utilities.Control the text color of an element to cool-gray-700 on hover using the
hover:text-cool-gray-700
utilities.Control the horizontal padding of an element to 1.5rem using the
px-6
utilities.Control the vertical padding of an element to 0.75rem using the
py-3
utilities.Control the background color of an element to gradient-to-b using the
bg-gradient-to-b
utilities.Control the text color of an element to white using the
text-white
utilities.Use
xl:w-2/4
to set an element to a fixed width(2/4) at only extremely large screen sizes.Control the margin on top side of an element to 5rem using the
mt-20
utilities.Control the margin on top side of an element to 10rem at only large screen sizes using the
lg:mt-40
utilities.Control the margin on left side of an element to 4rem at only large screen sizes using the
lg:ml-16
utilities.Control the text color of an element to left using the
text-left
utilities.Control the text color of an element to 6xl using the
text-6xl
utilities.Control the text color of an element to gray-900 using the
text-gray-900
utilities.Control the margin on top side of an element to 1.5rem using the
mt-6
utilities.Control the text color of an element to xl using the
text-xl
utilities.Control the text color of an element to true-gray-500 using the
text-true-gray-500
utilities.Control the horizontal padding of an element to 2rem using the
px-8
utilities.Control the vertical padding of an element to 1rem using the
py-4
utilities.Control the margin on top side of an element to 3rem using the
mt-12
utilities.Control the margin on top side of an element to 8rem at only large screen sizes using the
lg:mt-32
utilities.Use
w-12
to set an element to a fixed width(3rem).Use
h-12
to set an element to a fixed height(3rem).Control the background color of an element to cool-gray-100 using the
bg-cool-gray-100
utilities.Control the text color of an element to gray-800 using the
text-gray-800
utilities.Control the text color of an element to gray-900 on hover using the
hover:text-gray-900
utilities.Control the background color of an element to cool-gray-50 using the
hover:bg-cool-gray-50
utilities on hover.Use
w-6
to set an element to a fixed width(1.5rem).Use
h-6
to set an element to a fixed height(1.5rem).
Conclusion
The above is a step-by-step tutorial on how to use Tailwind CSS to build a Card hero section components, learn and follow along to implement your own components.