Published on

Advanced Guide: Create A Header Landing Page With Tailwind CSS

Tags
Header  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 Header Landing Page ui component

Header text and image

Why use Tailwind CSS to create a Header Landing Page ui component?

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

The preview of Header Landing Page ui component

Free download of the Header Landing Page's source code

The source code of Header Landing Page ui component

<header class="min-h-screen bg-white ">
  <!-- Navigaiton Bar -->
  <nav class="flex items-center py-8 px-14 justify-between">
  <div class="flex items-center">
    <h1 class="text-2xl font-bold text-gray-700 ">LandingKit</h1>
    <div class="ml-10">
      <ul class="md:flex space-x-8 hidden ">
        <li><a href="#" class="text-gray-800 font-semibold">Magazine</a></li>
        <li><a href="#" class="text-gray-800 font-semibold">World</a></li>
        <li><a href="#" class="text-gray-800 font-semibold">Tech</a></li>
        <li><a href="#" class="text-gray-800 font-semibold">Health</a></li>
        <li><a href="#" class="text-gray-800 font-semibold">Sport</a></li>
      </ul>
    </div>
  </div>
  <div class="lg:flex hidden items-center space-x-3 py-3 px-6 bg-indigo-600 text-white rounded-lg  transition-all duration-400 transform hover:scale-105 cursor-pointer hover:shadow-lg">
 <button>Buy now</button>
 <span>
   <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
  <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 19l-7-7 7-7m8 14l-7-7 7-7" />
</svg>
 </span>
  </div>
  </nav>
  <!-- End Navigation Bar -->

  <!-- Section Hero -->
  <!-- Box left -->
  <div class="md:flex space-x-16 mt-20 md:mr-0 mr-10">
  <div class="md:flex items-center pl-16 ">
    <div class="">
    <h class="lg:text-5xl  font-bold leading-tight text-3xl">Elegant Landing Pages  for your next project</h1>
    <p class="mt-4 text-lg font-normal ">Build your site in a few second based ready-to-use block and section, <br> it's a lot of fund.</p>
    <div class="flex mt-10 w-40 items-center space-x-3 py-3 px-6 bg-indigo-600 text-white rounded-lg  transition-all duration-400 transform hover:scale-105 cursor-pointer hover:shadow-lg">
    <button class="text-lg text-md ">Buy now</button>
   <span>
      <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" fill="none" viewBox="0 0 24 24" stroke="currentColor">
      <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M11 19l-7-7 7-7m8 14l-7-7 7-7" />
   </span>
    </div>
   </div>
  </div>
  <!-- Box right -->
  <div class="max-w-lg pr-24 md:flex justify-center items-center  hidden">
    <img class="rounded-lg" src="https://images.unsplash.com/photo-1483058712412-4245e9b90334" alt="">
  </div>
  </div>

  <!--Show Brand -->
  <div class="hidden lg:block">
      <ul class="flex mt-32 space-x-36 justify-center">
        <li><a href="#" class="text-2xl font-semibold text-gray-600">Google</a></li>
        <li><a href="#" class="text-2xl font-semibold text-gray-600">UBER</a></li>
        <li><a href="#" class="text-2xl font-semibold text-gray-600">Stripe</a></li>
        <li><a href="#" class="text-2xl font-semibold text-gray-600">Nike</a></li>
        <li><a href="#" class="text-2xl font-semibold text-gray-600">Mashable</a></li>
        <li><a href="#" class="text-2xl font-semibold text-gray-600">Airbnb</a></li>
      </ul>
  </div>
</header>

How to create a Header Landing Page 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 create a Header Landing Page component

  • min-h-screen
  • bg-white
  • flex
  • py-8
  • px-14
  • text-2xl
  • text-gray-700
  • ml-10
  • md:flex
  • hidden
  • text-gray-800
  • lg:flex
  • py-3
  • px-6
  • bg-indigo-600
  • text-white
  • h-5
  • w-5
  • mt-20
  • md:mr-0
  • mr-10
  • pl-16
  • lg:text-5xl
  • text-3xl
  • mt-4
  • text-lg
  • mt-10
  • w-40
  • text-md
  • max-w-lg
  • pr-24
  • lg:block
  • mt-32
  • text-gray-600

34 steps to create a Header Landing Page component with Tailwind CSS

  1. Set the minimum width/height of an element using the min-h-screen utilities.

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

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

  4. Control the vertical padding of an element to 2rem using the py-8 utilities.

  5. Control the horizontal padding of an element to 3.5rem using the px-14 utilities.

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

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

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

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

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

  11. Control the text color of an element to gray-800 using the text-gray-800 utilities.

  12. Use flex to create a block-level flex container at only large screen sizes.

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

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

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

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

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

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

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

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

  21. Control the margin on right side of an element to 2.5rem using the mr-10 utilities.

  22. Set the left padding of the element to 4rem using the pl-16 utilities class

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

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

  25. Control the margin on top side of an element to 1rem using the mt-4 utilities.

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

  27. Control the margin on top side of an element to 2.5rem using the mt-10 utilities.

  28. Use w-40 to set an element to a fixed width(10rem).

  29. Control the text color of an element to md using the text-md utilities.

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

  31. Control the padding on right side of an element to 6rem using the pr-24 utilities.

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

  33. Control the margin on top side of an element to 8rem using the mt-32 utilities.

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

Conclusion

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