Published on

Most Effective Ways To Make A Login Page With Tailwind CSS

Login 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 Login Page ui component

This is a tailwind login page made with the rules and components from tailwind starter kit.

Why use Tailwind CSS to make a Login Page ui component?

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

The preview of Login Page ui component

Free download of the Login Page's source code

The source code of Login Page ui component

<section class="absolute w-full top-0">
    <div class="absolute top-0 w-full h-full bg-gray-900" style="background-image: url(&quot;https://demos.creative-tim.com/tailwindcss-starter-project/static/media/register_bg_2.2fee0b50.png&quot;); background-size: 100%; background-repeat: no-repeat;"></div>
    <div class="container mx-auto px-4 h-full">
        <div class="flex content-center items-center justify-center h-full">
            <div class="w-full lg:w-4/12 px-4 pt-32">
                <div class="relative flex flex-col min-w-0 break-words w-full mb-6 shadow-lg rounded-lg bg-gray-300 border-0">
                    <div class="rounded-t mb-0 px-6 py-6">
                        <div class="text-center mb-3">
                            <h6 class="text-gray-600 text-sm font-bold">Sign in with</h6></div>
                        <div class="btn-wrapper text-center">
                            <button class="bg-white active:bg-gray-100 text-gray-800 font-normal px-4 py-2 rounded outline-none focus:outline-none mr-2 mb-1 uppercase shadow hover:shadow-md inline-flex items-center font-bold text-xs" type="button" style="transition: all 0.15s ease 0s;"><img alt="..." class="w-5 mr-1" src="https://demos.creative-tim.com/tailwindcss-starter-project/static/media/github.4ffd4fe7.svg">Github</button>
                            <button class="bg-white active:bg-gray-100 text-gray-800 font-normal px-4 py-2 rounded outline-none focus:outline-none mr-1 mb-1 uppercase shadow hover:shadow-md inline-flex items-center font-bold text-xs" type="button" style="transition: all 0.15s ease 0s;"><img alt="..." class="w-5 mr-1" src="https://demos.creative-tim.com/tailwindcss-starter-project/static/media/google.87be59a1.svg">Google</button>
                        </div>
                        <hr class="mt-6 border-b-1 border-gray-400">
                    </div>
                    <div class="flex-auto px-4 lg:px-10 py-10 pt-0">
                        <div class="text-gray-500 text-center mb-3 font-bold"><small>Or sign in with credentials</small></div>
                        <form>
                            <div class="relative w-full mb-3">
                                <label class="block uppercase text-gray-700 text-xs font-bold mb-2" for="grid-password">Email</label>
                                <input type="email" class="px-3 py-3 placeholder-gray-400 text-gray-700 bg-white rounded text-sm shadow focus:outline-none focus:shadow-outline w-full" placeholder="Email" style="transition: all 0.15s ease 0s;">
                            </div>
                            <div class="relative w-full mb-3">
                                <label class="block uppercase text-gray-700 text-xs font-bold mb-2" for="grid-password">Password</label>
                                <input type="password" class="px-3 py-3 placeholder-gray-400 text-gray-700 bg-white rounded text-sm shadow focus:outline-none focus:shadow-outline w-full" placeholder="Password" style="transition: all 0.15s ease 0s;">
                            </div>
                            <div>
                                <label class="inline-flex items-center cursor-pointer">
                                    <input id="customCheckLogin" type="checkbox" class="form-checkbox text-gray-800 ml-1 w-5 h-5" style="transition: all 0.15s ease 0s;"><span class="ml-2 text-sm font-semibold text-gray-700">Remember me</span></label>
                            </div>
                            <div class="text-center mt-6">
                                <button class="bg-gray-900 text-white active:bg-gray-700 text-sm font-bold uppercase px-6 py-3 rounded shadow hover:shadow-lg outline-none focus:outline-none mr-1 mb-1 w-full" type="button" style="transition: all 0.15s ease 0s;">Sign In</button>
                            </div>
                        </form>
                    </div>
                </div>
                <div class="flex flex-wrap mt-6">
                    <div class="w-1/2"><a href="#pablo" class="text-gray-300"><small>Forgot password?</small></a></div>
                    <div class="w-1/2 text-right"><a href="#pablo" class="text-gray-300"><small>Create new account</small></a></div>
                </div>
            </div>
        </div>
    </div>
    <footer class="absolute w-full bottom-0 bg-gray-900 pb-6">
        <div class="container mx-auto px-4">
            <hr class="mb-6 border-b-1 border-gray-700">
            <div class="flex flex-wrap items-center md:justify-between justify-center">
                <div class="w-full md:w-4/12 px-4">
                    <div class="text-sm text-white font-semibold py-1">Made with <a href="https://www.creative-tim.com/learning-lab/tailwind-starter-kit" class="text-white hover:text-gray-400 text-sm font-semibold py-1" target="_blank">Tailwind Starter Kit </a></div>
                </div>
                <div class="w-full md:w-8/12 px-4">
                    <ul class="flex flex-wrap list-none md:justify-end  justify-center">
                        <li><a href="https://www.creative-tim.com" class="text-white hover:text-gray-400 text-sm font-semibold block py-1 px-3" target="_blank">Creative Tim</a></li>
                        <li><a href="https://www.creative-tim.com/presentation" class="text-white hover:text-gray-400 text-sm font-semibold block py-1 px-3" target="_blank">About Us</a></li>
                        <li><a href="https://creative-tim.com/blog" class="text-white hover:text-gray-400 text-sm font-semibold block py-1 px-3" target="_blank">Blog</a></li>
                        <li><a href="https://github.com/creativetimofficial/argon-design-system/blob/master/LICENSE.md" class="text-white hover:text-gray-400 text-sm font-semibold block py-1 px-3" target="_blank">MIT License</a></li>
                    </ul>
                </div>
            </div>
        </div>
    </footer>
</section>

How to make a Login Page with Tailwind CSS?

Install tailwind css of verion 1.2.0

Use the link html tag to import the stylesheet of Tailwind CSS of the version 1.2.0

<link href=https://unpkg.com/[email protected]/dist/tailwind.min.css rel="stylesheet">

All the unility class needed to make a Login Page component

  • absolute
  • w-full
  • top-0
  • h-full
  • bg-gray-900
  • mx-auto
  • px-4
  • flex
  • lg:w-4/12
  • pt-32
  • relative
  • flex-col
  • min-w-0
  • mb-6
  • bg-gray-300
  • border-0
  • mb-0
  • px-6
  • py-6
  • text-center
  • mb-3
  • text-gray-600
  • text-sm
  • bg-white
  • active:bg-gray-100
  • text-gray-800
  • py-2
  • mr-2
  • mb-1
  • inline-flex
  • text-xs
  • w-5
  • mr-1
  • mt-6
  • border-b-1
  • border-gray-400
  • flex-auto
  • lg:px-10
  • py-10
  • pt-0
  • text-gray-500
  • block
  • text-gray-700
  • mb-2
  • px-3
  • py-3
  • ml-1
  • h-5
  • ml-2
  • text-white
  • active:bg-gray-700
  • flex-wrap
  • w-1/2
  • text-gray-300
  • text-right
  • bottom-0
  • pb-6
  • border-gray-700
  • md:w-4/12
  • py-1
  • hover:text-gray-400
  • md:w-8/12

62 steps to make a Login Page component with Tailwind CSS

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

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

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

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

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

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

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

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

  9. Use lg:w-4/12 to set an element to a fixed width(4/12) at only large screen sizes.

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

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

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

  13. Set the minimum width/height of an element using the min-w-0 utilities.

  14. Control the margin on bottom side of an element to 1.5rem using the mb-6 utilities.

  15. Control the background color of an element to gray-300 using the bg-gray-300 utilities.

  16. Control the border color of an element to 0rem using the border-0 utilities.

  17. Control the margin on bottom side of an element to 0rem using the mb-0 utilities.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  33. Control the margin on right side of an element to 0.25rem using the mr-1 utilities.

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

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

  36. Control the border color of an element to gray-400 using the border-gray-400 utilities.

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

  38. Control the horizontal padding of an element to 2.5rem at only large screen sizes using the lg:px-10 utilities.

  39. Control the vertical padding of an element to 2.5rem using the py-10 utilities.

  40. Control the padding on top side of an element to 0rem using the pt-0 utilities.

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

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

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

  44. Control the margin on bottom side of an element to 0.5rem using the mb-2 utilities.

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

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

  47. Control the margin on left side of an element to 0.25rem using the ml-1 utilities.

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

  49. Control the margin on left side of an element to 0.5rem using the ml-2 utilities.

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

  51. Control the background color of an element to gray-700 using the active:bg-gray-700 utilities on active.

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

  53. Use w-1/2 to set an element to a fixed width(1/2).

  54. Control the text color of an element to gray-300 using the text-gray-300 utilities.

  55. Control the text color of an element to right using the text-right utilities.

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

  57. Control the padding on bottom side of an element to 1.5rem using the pb-6 utilities.

  58. Control the border color of an element to gray-700 using the border-gray-700 utilities.

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

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

  61. Control the text color of an element to gray-400 on hover using the hover:text-gray-400 utilities.

  62. Use md:w-8/12 to set an element to a fixed width(8/12) at only medium screen sizes.

Conclusion

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