- Published on
6 Incredibly Easy Ways To Create A E Commerce Homepage Layout With Tailwind CSS Better While Spending Less

- What is Tailwind CSS?
- The description of E commerce Homepage layout ui component
- Why use Tailwind CSS to create a E commerce Homepage layout ui component?
- The preview of E commerce Homepage layout ui component
- The source code of E commerce Homepage layout ui component
- How to create a E commerce Homepage layout with Tailwind CSS?
- Install tailwind css of verion 2.1.4
- All the unility class needed to create a E commerce Homepage layout component
- 52 steps to create a E commerce Homepage layout 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 E commerce Homepage layout ui component
Tailwind css e commerce homepage layout by jamsheed ali
Why use Tailwind CSS to create a E commerce Homepage layout ui component?
- It can make the building process of E commerce Homepage layout ui component faster and more easily.
- Enables building complex responsive layouts and components freely.
- Minimum lines of CSS code in E commerce Homepage layout component file.
The preview of E commerce Homepage layout ui component
Free download of the E commerce Homepage layout's source code
The source code of E commerce Homepage layout ui component
<div class="bg-black">
<div class="flex relative text-center">
<h1 class="text-3xl tracking-wider text-white text-sha uppercase font-bold p-4 self-center z-10 content-center absolute text-center w-full md:text-4xl">Welcome to Lightning deals</h1>
<img class="w-full object-cover h-72 block mx-auto sm:block sm:w-full"
src="https://images.unsplash.com/photo-1505934333218-8fe21ff87e69?ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80"
alt="Banner" width="1920" height="288" />
</div>
</div>
<div class="p-5 mx-auto max-w-screen-xl">
<h2 class="font-bold uppercase text-xl pb-4">Best sellers</h2>
<div class="grid grid-flow-row-dense grid-cols-2 gap-3 justify-between sm:grid-cols-3 md:grid-cols-4">
<div>
<img class="border border-yellow-700 mb-1 border-solid w-full hover:border-yellow-500" alt="Best seller"
src="https://images.unsplash.com/photo-1594760467096-03761ecedde4?ixid=MnwxMjA3fDB8MHxzZWFyY2h8MzE2fHxsaWdodGluZ3xlbnwwfDJ8MHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=60" loading="lazy" />
<h2 class="pt-2 m-0 leading-4 font-semibold">Indoor light 2021 USA</h2>
<p>$210</p>
<p class="text-green-500 italic font-medium">In Stock</p>
</div>
<div class="">
<img class="border border-yellow-700 border-solid w-full hover:border-yellow-500" alt="Best seller"
src="https://images.unsplash.com/photo-1592009104079-88046bd5a09a?ixid=MnwxMjA3fDB8MHxzZWFyY2h8MzQwfHxsaWdodGluZ3xlbnwwfDJ8MHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=60" loading="lazy" />
<h2 class="pt-2 m-0 leading-4 font-semibold">Indoor light 2021 USA</h2>
<p>$210</p>
<p class="text-green-500 italic font-medium">In Stock</p>
</div>
<div class="">
<img class="border border-yellow-700 border-solid w-full hover:border-yellow-500" alt="Best seller"
src="https://images.unsplash.com/photo-1562635254-c14536b57bcb?ixid=MnwxMjA3fDB8MHxzZWFyY2h8NDd8fGxpZ2h0aW5nfGVufDB8MnwwfHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=60" loading="lazy" />
<h2 class="pt-2 m-0 leading-4 font-semibold">Indoor light 2021 USA</h2>
<p>$210</p>
<p class="text-green-500 italic font-medium">In Stock</p>
</div>
<div class="">
<img class="border border-yellow-700 border-solid w-full hover:border-yellow-500" alt="Best seller"
src="https://images.unsplash.com/photo-1595389397394-01fed35d24bc?ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTAwfHxsaWdodGluZ3xlbnwwfDJ8MHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=60" loading="lazy" />
<h2 class="pt-2 m-0 leading-4 font-semibold">Outdoor light 2021 USA</h2>
<p>$210</p>
<p class="text-red-500 italic font-medium">Out of Stock</p>
</div>
<div class="">
<img class="border border-yellow-700 border-solid w-full hover:border-yellow-500" alt="Best seller"
src="https://images.unsplash.com/photo-1577430605074-47eb89cc8969?ixid=MnwxMjA3fDB8MHxzZWFyY2h8MTExfHxsaWdodGluZ3xlbnwwfDJ8MHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=60" loading="lazy" />
<h2 class="pt-2 m-0 leading-4 font-semibold">Indoor light 2020 USA</h2>
<p>$210</p>
<p class="text-green-500 italic font-medium">In Stock</p>
</div>
<div class="">
<img class="border border-yellow-700 border-solid w-full hover:border-yellow-500" alt="Best seller"
src="https://images.unsplash.com/photo-1565475266382-7870244b60f9?ixid=MnwxMjA3fDB8MHxzZWFyY2h8MjYzfHxsaWdodGluZ3xlbnwwfDJ8MHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=60" loading="lazy" />
<h2 class="pt-2 m-0 leading-4 font-semibold">Indoor light 2021 USA</h2>
<p>$210</p>
<p class="text-green-500 italic font-medium">In Stock</p>
</div>
<div class="">
<img class="border border-yellow-700 border-solid w-full hover:border-yellow-500" alt="Best seller"
src="https://images.unsplash.com/photo-1588707698376-559b54b41846?ixid=MnwxMjA3fDB8MHxzZWFyY2h8MjgyfHxsaWdodGluZ3xlbnwwfDJ8MHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=60" loading="lazy" />
<h2 class="pt-2 m-0 leading-4 font-semibold">Outdoor light 2020 USA</h2>
<p>$210</p>
<p class="text-red-500 italic font-medium">Out of Stock</p>
</div>
<div class="">
<img class="border border-yellow-700 border-solid w-full hover:border-yellow-500" alt="Best seller"
src="https://images.unsplash.com/photo-1533637268824-0da337d92744?ixid=MnwxMjA3fDB8MHxzZWFyY2h8MzAyfHxsaWdodGluZ3xlbnwwfDJ8MHx8&ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=60" loading="lazy" />
<h2 class="pt-2 m-0 leading-4 font-semibold">Outdoor light 2021 USA</h2>
<p>$210</p>
<p class="text-green-500 italic font-medium">In Stock</p>
</div>
</div>
</div>
<div class="bg-gray-200">
<section class="py-5 mx-auto max-w-screen-xl sm:flex flex-grow-0 sm:p-5">
<article class="flex-col justify-center inline-flex self-stretch p-6">
<h2 class="uppercase font-semibold text-xl">Design</h2>
<strong class="text-lg pb-2 font-normal font-sans sm:text-2xl">Our 30 Year Journey</strong>
<p class="text-sm pb-4">Join us as we revisit our roots, tracing the path from bright idea to industry disruptors with a plan to fight climate change while creating beautiful things. </p>
<button class="font-semibold uppercase border-black border p-3 max-w-max hover:bg-gray-600 hover:text-white">Join us</button>
</article>
<figure>
<img
src="https://images.unsplash.com/photo-1606170033648-5d55a3edf314?ixid=MnwxMjA3fDB8MHxzZWFyY2h8MjR8fGxpZ2h0c3xlbnwwfHwwfHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=800&q=60"
alt="Banner" looding="lazy" />
</figure>
</section>
</div>
How to create a E commerce Homepage layout with Tailwind CSS?
Install tailwind css of verion 2.1.4
Use the script
html tag to import the script of Tailwind CSS of the version 2.1.4
<script src="https://cdn.tailwindcss.com"></script>
All the unility class needed to create a E commerce Homepage layout component
bg-black
flex
relative
text-center
text-3xl
text-white
text-sha
p-4
z-10
absolute
w-full
md:text-4xl
h-72
block
mx-auto
sm:block
sm:w-full
p-5
max-w-screen-xl
text-xl
pb-4
grid
grid-flow-row-dense
grid-cols-2
gap-3
sm:grid-cols-3
md:grid-cols-4
border-yellow-700
mb-1
border-solid
hover:border-yellow-500
pt-2
m-0
text-green-500
text-red-500
bg-gray-200
py-5
sm:flex
flex-grow-0
sm:p-5
flex-col
inline-flex
p-6
text-lg
pb-2
sm:text-2xl
text-sm
border-black
p-3
max-w-max
hover:bg-gray-600
hover:text-white
52 steps to create a E commerce Homepage layout component with Tailwind CSS
Control the background color of an element to black using the
bg-black
utilities.Use
flex
to create a block-level flex container.Use
relative
to position an element according to the normal flow of the document.Control the text color of an element to center using the
text-center
utilities.Control the text color of an element to 3xl using the
text-3xl
utilities.Control the text color of an element to white using the
text-white
utilities.Control the text color of an element to sha using the
text-sha
utilities.Control the padding on all sides of an element to 1rem using the
p-4
utilities.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
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
w-full
to set an element to a 100% based width.Control the text color of an element to 4xl at only medium screen sizes using the
md:text-4xl
utilities.Use
h-72
to set an element to a fixed height(18rem).Use
inline
utilities to put the element on its own line and fill its parent.Control the horizontal margin of an element to auto using the
mx-auto
utilities.Use
inline
utilities to put the element on its own line and fill its parent at only small screen sizes.Use
w-full
to set an element to a 100% based width at only small screen sizes.Control the padding on all sides of an element to 1.25rem using the
p-5
utilities.Set the maximum width/height of an element using the
max-w-screen-xl
utilities.Control the text color of an element to xl using the
text-xl
utilities.Control the padding on bottom side of an element to 1rem using the
pb-4
utilities.Use
grid
to create a grid container.Use
grid
to create a grid container.Use
grid
to create a grid container.To specify the width between columns, you can use the
gap-3
utilities.Use
grid
to create a grid container at only small screen sizes.Use
grid
to create a grid container at only medium screen sizes.Control the border color of an element to yellow-700 using the
border-yellow-700
utilities.Control the margin on bottom side of an element to 0.25rem using the
mb-1
utilities.Control the border color of an element to solid using the
border-solid
utilities.Control the border color of an element to yellow-500 using the
hover:border-yellow-500
utilities on hover.Control the padding on top side of an element to 0.5rem using the
pt-2
utilities.Control the margin on all sides of an element to 0rem using the
m-0
utilities.Control the text color of an element to green-500 using the
text-green-500
utilities.Control the text color of an element to red-500 using the
text-red-500
utilities.Control the background color of an element to gray-200 using the
bg-gray-200
utilities.Control the vertical padding of an element to 1.25rem using the
py-5
utilities.Use
flex
to create a block-level flex container at only small screen sizes.Use
flex
to create a block-level flex container.Control the padding on all sides of an element to 1.25rem at only small screen sizes using the
sm:p-5
utilities.Use
flex
to create a block-level flex container.Use
inline-flex
to create an inline flex container that flows with text.Control the padding on all sides of an element to 1.5rem using the
p-6
utilities.Control the text color of an element to lg using the
text-lg
utilities.Control the padding on bottom side of an element to 0.5rem using the
pb-2
utilities.Control the text color of an element to 2xl at only small screen sizes using the
sm:text-2xl
utilities.Control the text color of an element to sm using the
text-sm
utilities.Control the border color of an element to black using the
border-black
utilities.Control the padding on all sides of an element to 0.75rem using the
p-3
utilities.Set the maximum width/height of an element using the
max-w-max
utilities.Control the background color of an element to gray-600 using the
hover:bg-gray-600
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 create a E commerce Homepage layout components, learn and follow along to implement your own components.