- Published on
The 5 Really Obvious Ways To Build A Gradient Grid Hero With Tailwind CSS Better That You Ever Did

- What is Tailwind CSS?
- The description of Gradient grid hero ui component
- Why use Tailwind CSS to make a Gradient grid hero ui component?
- The preview of Gradient grid hero ui component
- The source code of Gradient grid hero ui component
- How to make a Gradient grid hero with Tailwind CSS?
- Install tailwind css of verion 2.2.4
- All the unility class needed to make a Gradient grid hero component
- 77 steps to make a Gradient grid hero 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 Gradient grid hero ui component
Side images in a grid with background gradient
Why use Tailwind CSS to make a Gradient grid hero ui component?
- It can make the building process of Gradient grid hero ui component faster and more easily.
- Enables building complex responsive layouts and components freely.
- Minimum lines of CSS code in Gradient grid hero component file.
The preview of Gradient grid hero ui component
Free download of the Gradient grid hero's source code
The source code of Gradient grid hero ui component
<div class="flex flex-col mx-auto -mt-20 overflow-hidden bg-gradient-to-r from-yellow-500 to-yellow-500">
<div class="relative z-20 flex w-full min-h-screen px-5 pt-20 mx-auto sm:px-12 sm:h-screen max-w-7xl sm:pt-0 lg:px-0">
<div class="w-full md:w-2/3">
<div class="flex flex-col items-start justify-center w-full h-full pb-20">
<div class="relative w-full lg:pl-10">
<div class="flex items-center justify-center bg-white rounded-lg w-12 h-12 sm:rounded-xl">
<svg class="w-12 h-12" fill="none">
<path d="m.848 15.848 5.304 5.304L11 16.304l4.848 4.848 5.304-5.304L16.304 11l4.848-4.848L15.848.848 11 5.696 6.152.848.848 6.152 5.696 11 .848 15.848Zm30 0 5.304 5.304L41 16.304l4.848 4.848 5.304-5.304L46.304 11l4.848-4.848L45.848.848 41 5.696 36.152.848l-5.304 5.304L35.696 11l-4.848 4.848ZM11 37.25v7.5h30v-7.5H11Z" fill="#000" />
</svg>
</div>
<h1 class="relative z-0 w-full max-w-md py-2 text-4xl font-black text-left text-white sm:py-5 sm:text-6xl" data-unsp-sanitized="clean">Side Title</h1>
</div>
<div class="flex flex-col items-start my-4 text-left lg:pl-10">
<p class="max-w-md mb-10 text-base font-light text-gray-200 sm:text-lg lg:text-xl dark:text-dark-200">Lorem ipsum dolor sit amet consectetur adipisicing elit. Ab laborum deleniti eius aliquam tenetur quisquam maiores tempora odit, distinctio ex porro dolore atque nulla a dolorum similique ratione voluptas consequatur.</p>
<div class="relative flex flex-col items-center justify-start w-full space-y-5 sm:w-auto lg:space-y-0 lg:space-x-5 lg:flex-row">
<a href="#" class="flex items-center justify-center w-full px-8 py-3 text-base font-medium leading-6 text-white text-blue-600 transition duration-150 ease-in-out border border-transparent rounded-lg sm:w-auto sm:rounded-full bg-blue-50 xl:px-10 hover:bg-white focus:outline-none focus:border-blue-700 focus:shadow-outline-blue md:py-4 xl:text-xl" data-unsp-sanitized="clean">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M16 12a4 4 0 10-8 0 4 4 0 008 0zm0 0v1.5a2.5 2.5 0 005 0V12a9 9 0 10-9 9m4.5-1.206a8.959 8.959 0 01-4.5 1.207" />
</svg>
btn
</a>
<a href="#" class="flex items-center justify-center w-full px-8 py-3 text-base font-medium leading-6 text-white text-blue-600 transition duration-150 ease-in-out border border-transparent rounded-lg sm:w-auto sm:rounded-full bg-blue-50 xl:px-10 hover:bg-white focus:outline-none focus:border-blue-700 focus:shadow-outline-blue md:py-4 xl:text-xl" data-unsp-sanitized="clean">
<svg xmlns="http://www.w3.org/2000/svg" class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 13l-3 3m0 0l-3-3m3 3V8m0 13a9 9 0 110-18 9 9 0 010 18z" />
</svg>
Launch The App
</a>
</div>
</div>
</div>
</div>
<div class="relative w-0 md:w-1/2"></div>
</div>
<div class="absolute top-0 left-0 z-0 flex items-start justify-center w-full h-screen overflow-hidden opacity-75">
<div class="relative z-20 w-1/2">
<div class="absolute top-0 left-0 w-full h-screen bg-gradient-to-r from-yellow-500 to-yellow-500"></div>
</div>
<div class="relative z-10 w-1/2 ">
<div class="absolute top-0 right-0 hidden w-full h-full sm:block">
<div class="flex items-center justify-center w-screen h-screen transform scale-75 -rotate-12 -translate-x-80 sm:-translate-x-64 sm:scale-125 md:scale-125 min-w-persp md:-translate-x-24">
<div class="flex flex-col flex-wrap items-start justify-start w-full h-screen mx-auto space-x-3 space-y-3 transformPerspective">
<div class="h-auto bg-gray-200 bg-cover rounded-lg overflow-hidden bg-top-center w-auto max-w-sm mt-3 ml-3">
<img src="https://source.unsplash.com/640x390/?tech,app" class="object-cover w-full h-auto" />
</div>
<div class="h-auto bg-gray-200 bg-cover rounded-lg overflow-hidden bg-top-center w-auto max-w-sm">
<img src="https://source.unsplash.com/640x390/?tech,app" class="object-cover w-full h-auto" />
</div>
<div class="h-auto bg-gray-200 bg-cover rounded-lg overflow-hidden bg-top-center w-auto max-w-sm">
<img src="https://source.unsplash.com/640x390/?tech,app" class="object-cover w-full h-auto" />
</div>
<div class="h-auto bg-gray-200 bg-cover rounded-lg overflow-hidden bg-top-center w-auto max-w-sm">
<img src="https://source.unsplash.com/640x390/?tech,app" class="object-cover w-full h-auto" />
</div>
<div class="h-auto bg-gray-200 bg-cover rounded-lg overflow-hidden bg-top-center w-auto max-w-sm">
<img src="https://source.unsplash.com/640x390/?tech,app" class="object-cover w-full h-auto" />
</div>
<div class="h-auto bg-gray-200 bg-cover rounded-lg overflow-hidden bg-top-center w-auto max-w-sm">
<img src="https://source.unsplash.com/640x390/?tech,app" class="object-cover w-full h-auto" />
</div>
<div class="h-auto bg-gray-200 bg-cover rounded-lg overflow-hidden bg-top-center w-auto max-w-sm">
<img src="https://source.unsplash.com/640x390/?tech,app" class="object-cover w-full h-auto" />
</div>
<div class="h-auto bg-gray-200 bg-cover rounded-lg overflow-hidden bg-top-center w-auto max-w-sm">
<img src="https://source.unsplash.com/640x390/?tech,app" class="object-cover w-full h-auto" />
</div>
<div class="h-auto bg-gray-200 bg-cover rounded-lg overflow-hidden bg-top-center w-auto max-w-sm">
<img src="https://source.unsplash.com/640x390/?tech,app" class="object-cover w-full h-auto" />
</div>
<div class="h-auto bg-gray-200 bg-cover rounded-lg overflow-hidden bg-top-center w-auto max-w-sm">
<img src="https://source.unsplash.com/640x390/?tech,app" class="object-cover w-full h-auto" />
</div>
<div class="h-auto bg-gray-200 bg-cover rounded-lg overflow-hidden bg-top-center w-auto max-w-sm">
<img src="https://source.unsplash.com/640x390/?tech,app" class="object-cover w-full h-auto" />
</div>
<div class="h-auto bg-gray-200 bg-cover rounded-lg overflow-hidden bg-top-center w-auto max-w-sm">
<img src="https://source.unsplash.com/640x390/?tech,app" class="object-cover w-full h-auto" />
</div>
<div class="h-auto bg-gray-200 bg-cover rounded-lg overflow-hidden bg-top-center w-auto max-w-sm">
<img src="https://source.unsplash.com/640x390/?tech,app" class="object-cover w-full h-auto" />
</div>
<div class="h-auto bg-gray-200 bg-cover rounded-lg overflow-hidden bg-top-center w-auto max-w-sm">
<img src="https://source.unsplash.com/640x390/?tech,app" class="object-cover w-full h-auto" />
</div>
<div class="h-auto bg-gray-200 bg-cover rounded-lg overflow-hidden bg-top-center w-auto max-w-sm">
<img src="https://source.unsplash.com/640x390/?tech,app" class="object-cover w-full h-auto" />
</div>
<div class="h-auto bg-gray-200 bg-cover rounded-lg overflow-hidden bg-top-center w-auto max-w-sm">
<img src="https://source.unsplash.com/640x390/?tech,app" class="object-cover w-full h-auto" />
</div>
<div class="h-auto bg-gray-200 bg-cover rounded-lg overflow-hidden bg-top-center w-auto max-w-sm">
<img src="https://source.unsplash.com/640x390/?tech,app" class="object-cover w-full h-auto" />
</div>
<div class="h-auto bg-gray-200 bg-cover rounded-lg overflow-hidden bg-top-center w-auto max-w-sm">
<img src="https://source.unsplash.com/640x390/?tech,app" class="object-cover w-full h-auto" />
</div>
<div class="h-auto bg-gray-200 bg-cover rounded-lg overflow-hidden bg-top-center w-auto max-w-sm">
<img src="https://source.unsplash.com/640x390/?tech,app" class="object-cover w-full h-auto" />
</div>
<div class="h-auto bg-gray-200 bg-cover rounded-lg overflow-hidden bg-top-center w-auto max-w-sm">
<img src="https://source.unsplash.com/640x390/?tech,app" class="object-cover w-full h-auto" />
</div>
<div class="h-auto bg-gray-200 bg-cover rounded-lg overflow-hidden bg-top-center w-auto max-w-sm">
<img src="https://source.unsplash.com/640x390/?tech,app" class="object-cover w-full h-auto" />
</div>
<div class="h-auto bg-gray-200 bg-cover rounded-lg overflow-hidden bg-top-center w-auto max-w-sm">
<img src="https://source.unsplash.com/640x390/?tech,app" class="object-cover w-full h-auto" />
</div>
<div class="h-auto bg-gray-200 bg-cover rounded-lg overflow-hidden bg-top-center w-auto max-w-sm">
<img src="https://source.unsplash.com/640x390/?tech,app" class="object-cover w-full h-auto" />
</div>
<div class="h-auto bg-gray-200 bg-cover rounded-lg overflow-hidden bg-top-center w-auto max-w-sm">
<img src="https://source.unsplash.com/640x390/?tech,app" class="object-cover w-full h-auto" />
</div>
<div class="h-auto bg-gray-200 bg-cover rounded-lg overflow-hidden bg-top-center w-auto max-w-sm">
<img src="https://source.unsplash.com/640x390/?tech,app" class="object-cover w-full h-auto" />
</div>
</div>
</div>
</div>
<div class="absolute top-0 left-0 z-50 w-full h-screen bg-gradient-to-r from-yellow-500 t to-transparent"></div>
</div>
</div>
</div>
How to make a Gradient grid hero 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 make a Gradient grid hero component
flex
flex-col
mx-auto
-mt-20
overflow-hidden
bg-gradient-to-r
relative
z-20
w-full
min-h-screen
px-5
pt-20
sm:px-12
sm:h-screen
max-w-7xl
sm:pt-0
lg:px-0
md:w-2/3
h-full
pb-20
lg:pl-10
bg-white
w-12
h-12
z-0
max-w-md
py-2
text-4xl
text-left
text-white
sm:py-5
sm:text-6xl
my-4
mb-10
text-base
text-gray-200
sm:text-lg
lg:text-xl
dark:text-dark-200
justify-start
sm:w-auto
lg:flex-row
px-8
py-3
text-blue-600
border-transparent
bg-blue-50
xl:px-10
hover:bg-white
focus:border-blue-700
md:py-4
xl:text-xl
h-6
w-6
w-0
md:w-1/2
absolute
top-0
left-0
h-screen
w-1/2
z-10
right-0
hidden
sm:block
w-screen
min-w-persp
flex-wrap
h-auto
bg-gray-200
bg-cover
bg-top-center
w-auto
max-w-sm
mt-3
ml-3
z-50
77 steps to make a Gradient grid hero component with Tailwind CSS
Use
flex
to create a block-level flex container.Use
flex
to create a block-level flex container.Control the horizontal margin of an element to auto using the
mx-auto
utilities.Control the margin on top side of an element to -5rem using the
-mt-20
utilities.Use
overflow-hidden
to clip any content within an element that overflows the bounds of that element.Control the background color of an element to gradient-to-r using the
bg-gradient-to-r
utilities.Use
relative
to position an element according to the normal flow of the document.Control the stack order (or three-dimensional positioning) of an element to 20 in Tailwind, regardless of order it has been displayed, using the
z-20
utilities.Use
w-full
to set an element to a 100% based width.Set the minimum width/height of an element using the
min-h-screen
utilities.Control the horizontal padding of an element to 1.25rem using the
px-5
utilities.Control the padding on top side of an element to 5rem using the
pt-20
utilities.Control the horizontal padding of an element to 3rem at only small screen sizes using the
sm:px-12
utilities.Use
h-screen
to make an element span the entire height of the viewport at only small screen sizes.Set the maximum width/height of an element using the
max-w-7xl
utilities.Control the padding on top side of an element to 0rem at only small screen sizes using the
sm:pt-0
utilities.Control the horizontal padding of an element to 0rem at only large screen sizes using the
lg:px-0
utilities.Use
md:w-2/3
to set an element to a fixed width(2/3) at only medium screen sizes.Use
h-full
to set an element’s height to 100% of its parent, as long as the parent has a defined height.Control the padding on bottom side of an element to 5rem using the
pb-20
utilities.Set the left padding of the element to 2.5rem at only large screen sizes using the
lg:pl-10
utilities classControl the background color of an element to white using the
bg-white
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 stack order (or three-dimensional positioning) of an element to 0 in Tailwind, regardless of order it has been displayed, using the
z-0
utilities.Set the maximum width/height of an element using the
max-w-md
utilities.Control the vertical padding of an element to 0.5rem using the
py-2
utilities.Control the text color of an element to 4xl using the
text-4xl
utilities.Control the text color of an element to left using the
text-left
utilities.Control the text color of an element to white using the
text-white
utilities.Control the vertical padding of an element to 1.25rem at only small screen sizes using the
sm:py-5
utilities.Control the text color of an element to 6xl at only small screen sizes using the
sm:text-6xl
utilities.Control the vertical margin of an element to 1rem using the
my-4
utilities.Control the margin on bottom side of an element to 2.5rem using the
mb-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-200 using the
text-gray-200
utilities.Control the text color of an element to lg at only small screen sizes using the
sm:text-lg
utilities.Control the text color of an element to xl at only large screen sizes using the
lg:text-xl
utilities.Control the text color of an element to dark-200 in dark theme using the
dark:text-dark-200
utilities.Use
justify-start
to justify items against the start of the container’s main axis.The
w-auto
utility can be useful if you need to remove an element’s assigned width under a specific condition, like at a particular breakpoint.Use
flex
to create a block-level flex container at only large screen sizes.Control the horizontal padding of an element to 2rem using the
px-8
utilities.Control the vertical padding of an element to 0.75rem using the
py-3
utilities.Control the text color of an element to blue-600 using the
text-blue-600
utilities.Control the border color of an element to transparent using the
border-transparent
utilities.Control the background color of an element to blue-50 using the
bg-blue-50
utilities.Control the horizontal padding of an element to 2.5rem at only extremely large screen sizes using the
xl:px-10
utilities.Control the background color of an element to white using the
hover:bg-white
utilities on hover.Control the border color of an element to blue-700 using the
focus:border-blue-700
utilities on focus.Control the vertical padding of an element to 1rem at only medium screen sizes using the
md:py-4
utilities.Control the text color of an element to xl at only extremely large screen sizes using the
xl:text-xl
utilities.Use
h-6
to set an element to a fixed height(1.5rem).Use
w-6
to set an element to a fixed width(1.5rem).Use
w-0
to set an element to a fixed width(0rem).Use
md:w-1/2
to set an element to a fixed width(1/2) at only medium screen sizes.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.Use the
top-0
utilities to set the top position of a positioned element to 0rem.Use the
left-0
utilities to set the left position of a positioned element to 0rem.Use
h-screen
to make an element span the entire height of the viewport.Use
w-1/2
to set an element to a fixed width(1/2).Control the stack order (or three-dimensional positioning) of an element to 10 in Tailwind, regardless of order it has been displayed, using the
z-10
utilities.Use the
right-0
utilities to set the right position of a positioned element to 0rem.Use
hidden
to set an element to display: none and remove it from the page layout.Use
inline
utilities to put the element on its own line and fill its parent at only small screen sizes.Use
w-screen
to make an element span the entire width of the viewport.Set the minimum width/height of an element using the
min-w-persp
utilities.Use
flex
to create a block-level flex container.Use
h-auto
to set an element to a fixed height(auto).Control the background color of an element to gray-200 using the
bg-gray-200
utilities.Control the background color of an element to cover using the
bg-cover
utilities.Control the background color of an element to top-center using the
bg-top-center
utilities.The
w-auto
utility can be useful if you need to remove an element’s assigned width under a specific condition, like at a particular breakpoint.Set the maximum width/height of an element using the
max-w-sm
utilities.Control the margin on top side of an element to 0.75rem using the
mt-3
utilities.Control the margin on left side of an element to 0.75rem using the
ml-3
utilities.Control the stack order (or three-dimensional positioning) of an element to 50 in Tailwind, regardless of order it has been displayed, using the
z-50
utilities.
Conclusion
The above is a step-by-step tutorial on how to use Tailwind CSS to make a Gradient grid hero components, learn and follow along to implement your own components.