Published on

How to Build A Hero Big Grid With Tailwind CSS?

Hero Big Grid

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 Big Grid ui component

Hero big grid for news and blog by twitter.com/ari_budin

Why use Tailwind CSS to create a Hero Big Grid ui component?

  • It can make the building process of Hero Big Grid ui component faster and more easily.
  • Enables building complex responsive layouts and components freely.
  • Minimum lines of CSS code in Hero Big Grid component file.

The preview of Hero Big Grid ui component

Free download of the Hero Big Grid's source code

The source code of Hero Big Grid ui component

<style>
.bg-gradient-cover {
	background-color: transparent;
    background-image: linear-gradient(transparent,rgba(0,0,0,0.92));
    background-position-y: -1px;
}
.max-h-98 {
    max-height: 24.3rem;
}
.box-one > article:nth-child(1) { 
	padding-top: 0;
	padding-bottom: 0.125rem;
	padding-right: 0.125rem;
}
.box-one > article:nth-child(2) {
	padding-top: 0;
	padding-bottom: 0.125rem;
	padding-left: 0.125rem;
}
.box-one > article:nth-child(3) {
	padding-top: 0.125rem;
	padding-bottom: 0.125rem;
	padding-right: 0.125rem;
}
.box-one > article:nth-child(4) {
	padding-top: 0.125rem;
	padding-bottom: 0.125rem;
	padding-left: 0.125rem;
}
</style>
<div class="bg-white py-6">
    <div class="xl:container mx-auto px-3 sm:px-4 xl:px-2">
        <!-- big grid 1 -->
        <div class="flex flex-row flex-wrap">
            <!--Start left cover-->
            <div class="flex-shrink max-w-full w-full lg:w-1/2 pb-1 lg:pb-0 lg:pr-1">
                <div class="relative hover-img max-h-98 overflow-hidden">
                    <a href="#">
                        <img class="max-w-full w-full mx-auto h-auto" src="https://tailnews.tailwindtemplate.net/src/img/dummy/img1.jpg" alt="Image description">
                    </a>
                    <div class="absolute px-5 pt-8 pb-5 bottom-0 w-full bg-gradient-cover">
                        <a href="#">
                            <h2 class="text-3xl font-bold capitalize text-white mb-3">Amazon Shoppers Are Ditching Designer Belts for This Best-Selling</h2>
                        </a>
                        <p class="text-gray-100 hidden sm:inline-block">This is a wider card with supporting text below as a natural lead-in to additional content. This very helpfull for generate default content..</p>
                        <div class="pt-2">
                            <div class="text-gray-100">
                                <div class="inline-block h-3 border-l-2 border-red-600 mr-2"></div>Europe
                            </div>
                        </div>
                    </div>
                </div>
            </div>
            <!--Start box news-->
            <div class="flex-shrink max-w-full w-full lg:w-1/2">
                <div class="box-one flex flex-row flex-wrap">
                    <article class="flex-shrink max-w-full w-full sm:w-1/2">
                        <div class="relative hover-img max-h-48 overflow-hidden">
                            <a href="#">
                                <img class="max-w-full w-full mx-auto h-auto" src="https://tailnews.tailwindtemplate.net/src/img/dummy/img2.jpg" alt="Image description">
                            </a>
                            <div class="absolute px-4 pt-7 pb-4 bottom-0 w-full bg-gradient-cover">
                                <a href="#">
                                    <h2 class="text-lg font-bold capitalize leading-tight text-white mb-1">News magazines are becoming obsolete, replaced by gadgets</h2>
                                </a>
                                <div class="pt-1">
                                    <div class="text-gray-100">
                                        <div class="inline-block h-3 border-l-2 border-red-600 mr-2"></div>Techno
                                    </div>
                                </div>
                            </div>
                        </div>
                    </article>
                    <article class="flex-shrink max-w-full w-full sm:w-1/2">
                        <div class="relative hover-img max-h-48 overflow-hidden">
                            <a href="#">
                                <img class="max-w-full w-full mx-auto h-auto" src="https://tailnews.tailwindtemplate.net/src/img/dummy/img3.jpg" alt="Image description">
                            </a>
                            <div class="absolute px-4 pt-7 pb-4 bottom-0 w-full bg-gradient-cover">
                                <a href="#">
                                    <h2 class="text-lg font-bold capitalize leading-tight text-white mb-1">Minimalist designs are starting to be popular with the next generation</h2>
                                </a>
                                <div class="pt-1">
                                    <div class="text-gray-100">
                                        <div class="inline-block h-3 border-l-2 border-red-600 mr-2"></div>Architecture
                                    </div>
                                </div>
                            </div>
                        </div>
                    </article>
                    <article class="flex-shrink max-w-full w-full sm:w-1/2">
                        <div class="relative hover-img max-h-48 overflow-hidden">
                            <a href="#">
                                <img class="max-w-full w-full mx-auto h-auto" src="https://tailnews.tailwindtemplate.net/src/img/dummy/img4.jpg" alt="Image description">
                            </a>
                            <div class="absolute px-4 pt-7 pb-4 bottom-0 w-full bg-gradient-cover">
                                <a href="#">
                                    <h2 class="text-lg font-bold capitalize leading-tight text-white mb-1">Tips for decorating the interior of the living room</h2>
                                </a>
                                <div class="pt-1">
                                    <div class="text-gray-100">
                                        <div class="inline-block h-3 border-l-2 border-red-600 mr-2"></div>Interior
                                    </div>
                                </div>
                            </div>
                        </div>
                    </article>
                    <article class="flex-shrink max-w-full w-full sm:w-1/2">
                        <div class="relative hover-img max-h-48 overflow-hidden">
                            <a href="#">
                                <img class="max-w-full w-full mx-auto h-auto" src="https://tailnews.tailwindtemplate.net/src/img/dummy/img5.jpg" alt="Image description">
                            </a>
                            <div class="absolute px-4 pt-7 pb-4 bottom-0 w-full bg-gradient-cover">
                                <a href="#">
                                    <h2 class="text-lg font-bold capitalize leading-tight text-white mb-1">Online taxi users are increasing drastically ahead of the new year</h2>
                                </a>
                                <div class="pt-1">
                                    <div class="text-gray-100">
                                        <div class="inline-block h-3 border-l-2 border-red-600 mr-2"></div>Lifestyle
                                    </div>
                                </div>
                            </div>
                        </div>
                    </article>
                </div>
            </div>
        </div>
    </div>
</div>

How to create a Hero Big Grid with Tailwind CSS?

Install tailwind css of verion 3.0.18

Use the script html tag to import the script of Tailwind CSS of the version 3.0.18

<script src="https://cdn.tailwindcss.com"></script>

All the unility class needed to create a Hero Big Grid component

  • bg-white
  • py-6
  • mx-auto
  • px-3
  • sm:px-4
  • xl:px-2
  • flex
  • flex-row
  • flex-wrap
  • flex-shrink
  • max-w-full
  • w-full
  • lg:w-1/2
  • pb-1
  • lg:pb-0
  • lg:pr-1
  • relative
  • max-h-98
  • overflow-hidden
  • h-auto
  • absolute
  • px-5
  • pt-8
  • pb-5
  • bottom-0
  • bg-gradient-cover
  • text-3xl
  • text-white
  • mb-3
  • text-gray-100
  • hidden
  • sm:inline-block
  • pt-2
  • inline-block
  • h-3
  • border-l-2
  • border-red-600
  • mr-2
  • sm:w-1/2
  • max-h-48
  • px-4
  • pt-7
  • pb-4
  • text-lg
  • mb-1
  • pt-1

46 steps to create a Hero Big Grid component with Tailwind CSS

  1. Control the background color of an element to white using the bg-white utilities.

  2. Control the vertical padding of an element to 1.5rem using the py-6 utilities.

  3. Control the horizontal margin of an element to auto using the mx-auto utilities.

  4. Control the horizontal padding of an element to 0.75rem using the px-3 utilities.

  5. Control the horizontal padding of an element to 1rem at only small screen sizes using the sm:px-4 utilities.

  6. Control the horizontal padding of an element to 0.5rem at only extremely large screen sizes using the xl:px-2 utilities.

  7. Use flex to create a block-level flex container.

  8. Use flex to create a block-level flex container.

  9. Use flex to create a block-level flex container.

  10. Use flex to create a block-level flex container.

  11. Set the maximum width/height of an element using the max-w-full utilities.

  12. Use w-full to set an element to a 100% based width.

  13. Use lg:w-1/2 to set an element to a fixed width(1/2) at only large screen sizes.

  14. Control the padding on bottom side of an element to 0.25rem using the pb-1 utilities.

  15. Control the padding on bottom side of an element to 0rem at only large screen sizes using the lg:pb-0 utilities.

  16. Control the padding on right side of an element to 0.25rem at only large screen sizes using the lg:pr-1 utilities.

  17. Use relative to position an element according to the normal flow of the document.

  18. Set the maximum width/height of an element using the max-h-98 utilities.

  19. Use overflow-hidden to clip any content within an element that overflows the bounds of that element.

  20. Use h-auto to set an element to a fixed height(auto).

  21. 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.

  22. Control the horizontal padding of an element to 1.25rem using the px-5 utilities.

  23. Control the padding on top side of an element to 2rem using the pt-8 utilities.

  24. Control the padding on bottom side of an element to 1.25rem using the pb-5 utilities.

  25. Use the bottom-0 utilities to set the bottom position of a positioned element to 0rem.

  26. Control the background color of an element to gradient-cover using the bg-gradient-cover utilities.

  27. Control the text color of an element to 3xl using the text-3xl utilities.

  28. Control the text color of an element to white using the text-white utilities.

  29. Control the margin on bottom side of an element to 0.75rem using the mb-3 utilities.

  30. Control the text color of an element to gray-100 using the text-gray-100 utilities.

  31. Use hidden to set an element to display: none and remove it from the page layout.

  32. Use inline-block utilities to wrap the element to prevent the text inside from extending beyond its parent at only small screen sizes.

  33. Control the padding on top side of an element to 0.5rem using the pt-2 utilities.

  34. Use inline-block utilities to wrap the element to prevent the text inside from extending beyond its parent.

  35. Use h-3 to set an element to a fixed height(0.75rem).

  36. Control the border color of an element to l-2 using the border-l-2 utilities.

  37. Control the border color of an element to red-600 using the border-red-600 utilities.

  38. Control the margin on right side of an element to 0.5rem using the mr-2 utilities.

  39. Use sm:w-1/2 to set an element to a fixed width(1/2) at only small screen sizes.

  40. Set the maximum width/height of an element using the max-h-48 utilities.

  41. Control the horizontal padding of an element to 1rem using the px-4 utilities.

  42. Control the padding on top side of an element to 1.75rem using the pt-7 utilities.

  43. Control the padding on bottom side of an element to 1rem using the pb-4 utilities.

  44. Control the text color of an element to lg using the text-lg utilities.

  45. Control the margin on bottom side of an element to 0.25rem using the mb-1 utilities.

  46. Control the padding on top side of an element to 0.25rem using the pt-1 utilities.

Conclusion

The above is a step-by-step tutorial on how to use Tailwind CSS to create a Hero Big Grid components, learn and follow along to implement your own components.