Published on

How to Create A website landing page With Tailwind CSS?

website landing page

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 website landing page ui component

Website landing page tailwindcss

Why use Tailwind CSS to build a website landing page ui component?

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

The preview of website landing page ui component

Free download of the website landing page's source code

The source code of website landing page ui component

<!-- Section 1 -->
    <section class="w-full px-6 pb-12 antialiased bg-white">
      <div class="mx-auto max-w-7xl">
        <nav
          class="relative z-50 h-24 select-none"
          x-data="{ showMenu: false }"
        >
          <div
            class="container relative flex flex-wrap items-center justify-between h-24 mx-auto overflow-hidden font-medium border-b border-gray-200 md:overflow-visible lg:justify-center sm:px-4 md:px-2"
          >
            <div class="flex items-center justify-start w-1/4 h-full pr-4">
              <a href="#_" class="inline-block py-4 md:py-0">
                <span class="p-1 text-xl font-black leading-none text-gray-900"
                  ><span>tailwind</span
                  ><span class="text-indigo-600">.</span></span
                >
              </a>
            </div>
            <div
              class="top-0 left-0 items-start hidden w-full h-full p-4 text-sm bg-gray-900 bg-opacity-50 md:items-center md:w-3/4 md:absolute lg:text-base md:bg-transparent md:p-0 md:relative md:flex"
              :class="{'flex fixed': showMenu, 'hidden': !showMenu }"
            >
              <div
                class="flex-col w-full h-auto overflow-hidden bg-white rounded-lg md:bg-transparent md:overflow-visible md:rounded-none md:relative md:flex md:flex-row"
              >
                <a
                  href="#_"
                  class="inline-flex items-center block w-auto h-16 px-6 text-xl font-black leading-none text-gray-900 md:hidden"
                  >tails<span class="text-indigo-600">.</span></a
                >
                <div
                  class="flex flex-col items-start justify-center w-full space-x-6 text-center lg:space-x-8 md:w-2/3 md:mt-0 md:flex-row md:items-center"
                >
                  <a
                    href="#_"
                    class="inline-block w-full py-2 mx-0 ml-6 font-medium text-left text-indigo-600 md:ml-0 md:w-auto md:px-0 md:mx-2 lg:mx-3 md:text-center"
                    >Home</a
                  >
                  <a
                    href="#_"
                    class="inline-block w-full py-2 mx-0 font-medium text-left text-gray-700 md:w-auto md:px-0 md:mx-2 hover:text-indigo-600 lg:mx-3 md:text-center"
                    >Features</a
                  >
                  <a
                    href="#_"
                    class="inline-block w-full py-2 mx-0 font-medium text-left text-gray-700 md:w-auto md:px-0 md:mx-2 hover:text-indigo-600 lg:mx-3 md:text-center"
                    >Blog</a
                  >
                  <a
                    href="#_"
                    class="inline-block w-full py-2 mx-0 font-medium text-left text-gray-700 md:w-auto md:px-0 md:mx-2 hover:text-indigo-600 lg:mx-3 md:text-center"
                    >Contact</a
                  >
                  <a
                    href="#_"
                    class="absolute top-0 left-0 hidden py-2 mt-6 ml-10 mr-2 text-gray-600 lg:inline-block md:mt-0 md:ml-2 lg:mx-3 md:relative"
                  >
                    <svg
                      class="inline w-5 h-5"
                      fill="none"
                      stroke-linecap="round"
                      stroke-linejoin="round"
                      stroke-width="2"
                      viewBox="0 0 24 24"
                      stroke="currentColor"
                    >
                      <path
                        d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"
                      ></path>
                    </svg>
                  </a>
                </div>
                <div
                  class="flex flex-col items-start justify-end w-full pt-4 md:items-center md:w-1/3 md:flex-row md:py-0"
                >
                  <a
                    href="#"
                    class="w-full px-6 py-2 mr-0 text-gray-700 md:px-0 lg:pl-2 md:mr-4 lg:mr-5 md:w-auto"
                    >Sign In</a
                  >
                  <a
                    href="#_"
                    class="inline-flex items-center w-full px-6 py-3 text-sm font-medium leading-4 text-white bg-indigo-600 md:px-3 md:w-auto md:rounded-full lg:px-5 hover:bg-indigo-500 focus:outline-none md:focus:ring-2 focus:ring-0 focus:ring-offset-2 focus:ring-indigo-600"
                    >Sign Up</a
                  >
                </div>
              </div>
            </div>
            <div
              @click="showMenu = !showMenu"
              class="absolute right-0 flex flex-col items-center items-end justify-center w-10 h-10 bg-white rounded-full cursor-pointer md:hidden hover:bg-gray-100"
            >
              <svg
                class="w-6 h-6 text-gray-700"
                x-show="!showMenu"
                fill="none"
                stroke-linecap="round"
                stroke-linejoin="round"
                stroke-width="2"
                viewBox="0 0 24 24"
                stroke="currentColor"
                x-cloak=""
              >
                <path d="M4 6h16M4 12h16M4 18h16"></path>
              </svg>
              <svg
                class="w-6 h-6 text-gray-700"
                x-show="showMenu"
                fill="none"
                stroke="currentColor"
                viewBox="0 0 24 24"
                xmlns="http://www.w3.org/2000/svg"
                x-cloak=""
              >
                <path
                  stroke-linecap="round"
                  stroke-linejoin="round"
                  stroke-width="2"
                  d="M6 18L18 6M6 6l12 12"
                ></path>
              </svg>
            </div>
          </div>
        </nav>

        <!-- Main Hero Content -->
        <div
          class="container max-w-lg px-4 py-32 mx-auto text-left md:max-w-none md:text-center"
        >
          <h1
            class="text-5xl font-extrabold leading-10 tracking-tight text-left text-gray-900 md:text-center sm:leading-none md:text-6xl lg:text-7xl"
          >
            <span class="inline md:block">Start Crafting Your</span>
            <span
              class="relative mt-2 text-transparent bg-clip-text bg-gradient-to-br from-indigo-600 to-indigo-500 md:inline-block"
              >Next Great Idea</span
            >
          </h1>
          <div
            class="mx-auto mt-5 text-gray-500 md:mt-12 md:max-w-lg md:text-center lg:text-lg"
          >
            Simplifying the creation of landing pages, blog pages, application
            pages and so much more!
          </div>
          <div class="flex flex-col items-center mt-12 text-center">
            <span class="relative inline-flex w-full md:w-auto">
              <a
                href="#_"
                class="inline-flex items-center justify-center w-full px-8 py-4 text-base font-bold leading-6 text-white bg-indigo-600 border border-transparent rounded-full md:w-auto hover:bg-indigo-500 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-600"
              >
                Purchase Now
              </a>
              <span
                class="absolute top-0 right-0 px-2 py-1 -mt-3 -mr-6 text-xs font-medium leading-tight text-white bg-green-400 rounded-full"
                >only $15/mo</span
              >
            </span>
            <a href="#" class="mt-3 text-sm text-indigo-500">Learn More</a>
          </div>
        </div>
        <!-- End Main Hero Content -->
      </div>
    </section>

How to build a website landing page 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 build a website landing page component

  • w-full
  • px-6
  • pb-12
  • bg-white
  • mx-auto
  • max-w-7xl
  • relative
  • z-50
  • h-24
  • flex
  • flex-wrap
  • overflow-hidden
  • border-b
  • border-gray-200
  • md:overflow-visible
  • sm:px-4
  • md:px-2
  • justify-start
  • w-1/4
  • h-full
  • pr-4
  • inline-block
  • py-4
  • md:py-0
  • p-1
  • text-xl
  • text-gray-900
  • text-indigo-600
  • top-0
  • left-0
  • hidden
  • p-4
  • text-sm
  • bg-gray-900
  • bg-opacity-50
  • md:w-3/4
  • md:absolute
  • lg:text-base
  • md:bg-transparent
  • md:p-0
  • md:relative
  • md:flex
  • fixed
  • flex-col
  • h-auto
  • md:flex-row
  • inline-flex
  • block
  • w-auto
  • h-16
  • md:hidden
  • text-center
  • md:w-2/3
  • md:mt-0
  • py-2
  • mx-0
  • ml-6
  • text-left
  • md:ml-0
  • md:w-auto
  • md:px-0
  • md:mx-2
  • lg:mx-3
  • md:text-center
  • text-gray-700
  • hover:text-indigo-600
  • absolute
  • mt-6
  • ml-10
  • mr-2
  • text-gray-600
  • lg:inline-block
  • md:ml-2
  • inline
  • w-5
  • h-5
  • pt-4
  • md:w-1/3
  • mr-0
  • lg:pl-2
  • md:mr-4
  • lg:mr-5
  • py-3
  • text-white
  • bg-indigo-600
  • md:px-3
  • lg:px-5
  • hover:bg-indigo-500
  • right-0
  • w-10
  • h-10
  • hover:bg-gray-100
  • w-6
  • h-6
  • max-w-lg
  • px-4
  • py-32
  • md:max-w-none
  • text-5xl
  • md:text-6xl
  • lg:text-7xl
  • md:block
  • mt-2
  • text-transparent
  • bg-clip-text
  • bg-gradient-to-br
  • md:inline-block
  • mt-5
  • text-gray-500
  • md:mt-12
  • md:max-w-lg
  • lg:text-lg
  • mt-12
  • px-8
  • text-base
  • border-transparent
  • px-2
  • py-1
  • -mt-3
  • -mr-6
  • text-xs
  • bg-green-400
  • mt-3
  • text-indigo-500

124 steps to build a website landing page component with Tailwind CSS

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

  2. Control the horizontal padding of an element to 1.5rem using the px-6 utilities.

  3. Control the padding on bottom side of an element to 3rem using the pb-12 utilities.

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

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

  6. Set the maximum width/height of an element using the max-w-7xl utilities.

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

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

  9. Use h-24 to set an element to a fixed height(6rem).

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

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

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

  13. Control the border color of an element to b using the border-b utilities.

  14. Control the border color of an element to gray-200 using the border-gray-200 utilities.

  15. Use overflow-visible to prevent content within an element from being clipped at only medium screen sizes. Note that any content that overflows the bounds of the element will then be visible.

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

  17. Control the horizontal padding of an element to 0.5rem at only medium screen sizes using the md:px-2 utilities.

  18. Use justify-start to justify items against the start of the container’s main axis.

  19. Use w-1/4 to set an element to a fixed width(1/4).

  20. Use h-full to set an element’s height to 100% of its parent, as long as the parent has a defined height.

  21. Control the padding on right side of an element to 1rem using the pr-4 utilities.

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

  23. Control the vertical padding of an element to 1rem using the py-4 utilities.

  24. Control the vertical padding of an element to 0rem at only medium screen sizes using the md:py-0 utilities.

  25. Control the padding on all sides of an element to 0.25rem using the p-1 utilities.

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

  27. Control the text color of an element to gray-900 using the text-gray-900 utilities.

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

  29. Use the top-0 utilities to set the top position of a positioned element to 0rem.

  30. Use the left-0 utilities to set the left position of a positioned element to 0rem.

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

  32. Control the padding on all sides of an element to 1rem using the p-4 utilities.

  33. Control the text color of an element to sm using the text-sm utilities.

  34. Control the background color of an element to gray-900 using the bg-gray-900 utilities.

  35. Control the background color of an element to opacity-50 using the bg-opacity-50 utilities.

  36. Use md:w-3/4 to set an element to a fixed width(3/4) at only medium screen sizes.

  37. Use absolute to position an element outside of the normal flow of the document at only medium screen sizes, causing neighboring elements to act as if the element doesn’t exist.

  38. Control the text color of an element to base at only large screen sizes using the lg:text-base utilities.

  39. Control the background color of an element to transparent using the md:bg-transparent utilities at only medium screen sizes.

  40. Control the padding on all sides of an element to 0rem at only medium screen sizes using the md:p-0 utilities.

  41. Use relative to position an element according to the normal flow of the document at only medium screen sizes.

  42. Use flex to create a block-level flex container at only medium screen sizes.

  43. Use fixed to position an element relative to the browser window.

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

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

  46. Use flex to create a block-level flex container at only medium screen sizes.

  47. Use inline-flex to create an inline flex container that flows with text.

  48. Use inline utilities to put the element on its own line and fill its parent.

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

  50. Use h-16 to set an element to a fixed height(4rem).

  51. Use hidden to set an element to display: none and remove it from the page layout at only medium screen sizes.

  52. Control the text color of an element to center using the text-center utilities.

  53. Use md:w-2/3 to set an element to a fixed width(2/3) at only medium screen sizes.

  54. Control the margin on top side of an element to 0rem at only medium screen sizes using the md:mt-0 utilities.

  55. Control the vertical padding of an element to 0.5rem using the py-2 utilities.

  56. Control the horizontal margin of an element to 0rem using the mx-0 utilities.

  57. Control the margin on left side of an element to 1.5rem using the ml-6 utilities.

  58. Control the text color of an element to left using the text-left utilities.

  59. Control the margin on left side of an element to 0rem at only medium screen sizes using the md:ml-0 utilities.

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

  61. Control the horizontal padding of an element to 0rem at only medium screen sizes using the md:px-0 utilities.

  62. Control the horizontal margin of an element to 0.5rem at only medium screen sizes using the md:mx-2 utilities.

  63. Control the horizontal margin of an element to 0.75rem at only large screen sizes using the lg:mx-3 utilities.

  64. Control the text color of an element to center at only medium screen sizes using the md:text-center utilities.

  65. Control the text color of an element to gray-700 using the text-gray-700 utilities.

  66. Control the text color of an element to indigo-600 on hover using the hover:text-indigo-600 utilities.

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

  68. Control the margin on top side of an element to 1.5rem using the mt-6 utilities.

  69. Control the margin on left side of an element to 2.5rem using the ml-10 utilities.

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

  71. Control the text color of an element to gray-600 using the text-gray-600 utilities.

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

  73. Control the margin on left side of an element to 0.5rem at only medium screen sizes using the md:ml-2 utilities.

  74. Use inline utilities to control the flow of text inside the element to wrap normally.

  75. Use w-5 to set an element to a fixed width(1.25rem).

  76. Use h-5 to set an element to a fixed height(1.25rem).

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

  78. Use md:w-1/3 to set an element to a fixed width(1/3) at only medium screen sizes.

  79. Control the margin on right side of an element to 0rem using the mr-0 utilities.

  80. Adjust the left padding of an element to 0.5rem at only large screen sizes using the lg:pl-2 utilities class

  81. Control the margin on right side of an element to 1rem at only medium screen sizes using the md:mr-4 utilities.

  82. Control the margin on right side of an element to 1.25rem at only large screen sizes using the lg:mr-5 utilities.

  83. Control the vertical padding of an element to 0.75rem using the py-3 utilities.

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

  85. Control the background color of an element to indigo-600 using the bg-indigo-600 utilities.

  86. Control the horizontal padding of an element to 0.75rem at only medium screen sizes using the md:px-3 utilities.

  87. Control the horizontal padding of an element to 1.25rem at only large screen sizes using the lg:px-5 utilities.

  88. Control the background color of an element to indigo-500 using the hover:bg-indigo-500 utilities on hover.

  89. Use the right-0 utilities to set the right position of a positioned element to 0rem.

  90. Use w-10 to set an element to a fixed width(2.5rem).

  91. Use h-10 to set an element to a fixed height(2.5rem).

  92. Control the background color of an element to gray-100 using the hover:bg-gray-100 utilities on hover.

  93. Use w-6 to set an element to a fixed width(1.5rem).

  94. Use h-6 to set an element to a fixed height(1.5rem).

  95. Set the maximum width/height of an element using the max-w-lg utilities.

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

  97. Control the vertical padding of an element to 8rem using the py-32 utilities.

  98. Set the maximum width/height of an element using the md:max-w-none utilities at only medium screen sizes.

  99. Control the text color of an element to 5xl using the text-5xl utilities.

  100. Control the text color of an element to 6xl at only medium screen sizes using the md:text-6xl utilities.

  101. Control the text color of an element to 7xl at only large screen sizes using the lg:text-7xl utilities.

  102. Use inline utilities to put the element on its own line and fill its parent at only medium screen sizes.

  103. Control the margin on top side of an element to 0.5rem using the mt-2 utilities.

  104. Control the text color of an element to transparent using the text-transparent utilities.

  105. Control the background color of an element to clip-text using the bg-clip-text utilities.

  106. Control the background color of an element to gradient-to-br using the bg-gradient-to-br utilities.

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

  108. Control the margin on top side of an element to 1.25rem using the mt-5 utilities.

  109. Control the text color of an element to gray-500 using the text-gray-500 utilities.

  110. Control the margin on top side of an element to 3rem at only medium screen sizes using the md:mt-12 utilities.

  111. Set the maximum width/height of an element using the md:max-w-lg utilities at only medium screen sizes.

  112. Control the text color of an element to lg at only large screen sizes using the lg:text-lg utilities.

  113. Control the margin on top side of an element to 3rem using the mt-12 utilities.

  114. Control the horizontal padding of an element to 2rem using the px-8 utilities.

  115. Control the text color of an element to base using the text-base utilities.

  116. Control the border color of an element to transparent using the border-transparent utilities.

  117. Control the horizontal padding of an element to 0.5rem using the px-2 utilities.

  118. Control the vertical padding of an element to 0.25rem using the py-1 utilities.

  119. Control the margin on top side of an element to -0.75rem using the -mt-3 utilities.

  120. Control the margin on right side of an element to -1.5rem using the -mr-6 utilities.

  121. Control the text color of an element to xs using the text-xs utilities.

  122. Control the background color of an element to green-400 using the bg-green-400 utilities.

  123. Control the margin on top side of an element to 0.75rem using the mt-3 utilities.

  124. Control the text color of an element to indigo-500 using the text-indigo-500 utilities.

Conclusion

The above is a step-by-step tutorial on how to use Tailwind CSS to build a website landing page components, learn and follow along to implement your own components.