Published on

How To Make A Login Page With Image With Tailwind CSS In 5 Easy Steps

Login Page With Image

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 With Image ui component

Login page with image from merakiui.com/components

Why use Tailwind CSS to build a Login Page With Image ui component?

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

The preview of Login Page With Image ui component

Free download of the Login Page With Image's source code

The source code of Login Page With Image ui component

<div class="bg-white dark:bg-gray-900">
        <div class="flex justify-center h-screen">
            <div class="hidden bg-cover lg:block lg:w-2/3" style="background-image: url(https://images.unsplash.com/photo-1616763355603-9755a640a287?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1470&q=80)">
                <div class="flex items-center h-full px-20 bg-gray-900 bg-opacity-40">
                    <div>
                        <h2 class="text-4xl font-bold text-white">Brand</h2>
                        
                        <p class="max-w-xl mt-3 text-gray-300">Lorem ipsum dolor sit, amet consectetur adipisicing elit. In autem ipsa, nulla laboriosam dolores, repellendus perferendis libero suscipit nam temporibus molestiae</p>
                    </div>
                </div>
            </div>
            
            <div class="flex items-center w-full max-w-md px-6 mx-auto lg:w-2/6">
                <div class="flex-1">
                    <div class="text-center">
                        <h2 class="text-4xl font-bold text-center text-gray-700 dark:text-white">Brand</h2>
                        
                        <p class="mt-3 text-gray-500 dark:text-gray-300">Sign in to access your account</p>
                    </div>

                    <div class="mt-8">
                        <form>
                            <div>
                                <label for="email" class="block mb-2 text-sm text-gray-600 dark:text-gray-200">Email Address</label>
                                <input type="email" name="email" id="email" placeholder="[email protected]" class="block w-full px-4 py-2 mt-2 text-gray-700 placeholder-gray-400 bg-white border border-gray-200 rounded-md dark:placeholder-gray-600 dark:bg-gray-900 dark:text-gray-300 dark:border-gray-700 focus:border-blue-400 dark:focus:border-blue-400 focus:ring-blue-400 focus:outline-none focus:ring focus:ring-opacity-40" />
                            </div>

                            <div class="mt-6">
                                <div class="flex justify-between mb-2">
                                    <label for="password" class="text-sm text-gray-600 dark:text-gray-200">Password</label>
                                    <a href="#" class="text-sm text-gray-400 focus:text-blue-500 hover:text-blue-500 hover:underline">Forgot password?</a>
                                </div>

                                <input type="password" name="password" id="password" placeholder="Your Password" class="block w-full px-4 py-2 mt-2 text-gray-700 placeholder-gray-400 bg-white border border-gray-200 rounded-md dark:placeholder-gray-600 dark:bg-gray-900 dark:text-gray-300 dark:border-gray-700 focus:border-blue-400 dark:focus:border-blue-400 focus:ring-blue-400 focus:outline-none focus:ring focus:ring-opacity-40" />
                            </div>

                            <div class="mt-6">
                                <button
                                    class="w-full px-4 py-2 tracking-wide text-white transition-colors duration-200 transform bg-blue-500 rounded-md hover:bg-blue-400 focus:outline-none focus:bg-blue-400 focus:ring focus:ring-blue-300 focus:ring-opacity-50">
                                    Sign in
                                </button>
                            </div>

                        </form>

                        <p class="mt-6 text-sm text-center text-gray-400">Don&#x27;t have an account yet? <a href="#" class="text-blue-500 focus:outline-none focus:underline hover:underline">Sign up</a>.</p>
                    </div>
                </div>
            </div>
        </div>
    </div>

How to build a Login Page With Image 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 Login Page With Image component

  • bg-white
  • dark:bg-gray-900
  • flex
  • h-screen
  • hidden
  • bg-cover
  • lg:block
  • lg:w-2/3
  • h-full
  • px-20
  • bg-gray-900
  • bg-opacity-40
  • text-4xl
  • text-white
  • max-w-xl
  • mt-3
  • text-gray-300
  • w-full
  • max-w-md
  • px-6
  • mx-auto
  • lg:w-2/6
  • flex-1
  • text-center
  • text-gray-700
  • dark:text-white
  • text-gray-500
  • dark:text-gray-300
  • mt-8
  • block
  • mb-2
  • text-sm
  • text-gray-600
  • dark:text-gray-200
  • px-4
  • py-2
  • mt-2
  • border-gray-200
  • dark:border-gray-700
  • focus:border-blue-400
  • mt-6
  • text-gray-400
  • focus:text-blue-500
  • hover:text-blue-500
  • bg-blue-500
  • hover:bg-blue-400
  • focus:bg-blue-400
  • text-blue-500

48 steps to build a Login Page With Image component with Tailwind CSS

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

  2. Control the background color of an element to gray-900 using the dark:bg-gray-900 utilities in dark theme.

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

  4. Use h-screen to make an element span the entire height of the viewport.

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

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

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

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

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

  10. Control the horizontal padding of an element to 5rem using the px-20 utilities.

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

  12. Control the background color of an element to opacity-40 using the bg-opacity-40 utilities.

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

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

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

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

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

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

  19. Set the maximum width/height of an element using the max-w-md utilities.

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

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

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

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

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

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

  26. Control the text color of an element to white in dark theme using the dark:text-white utilities.

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

  28. Control the text color of an element to gray-300 in dark theme using the dark:text-gray-300 utilities.

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

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

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

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

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

  34. Control the text color of an element to gray-200 in dark theme using the dark:text-gray-200 utilities.

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

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

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

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

  39. Control the border color of an element to gray-700 using the dark:border-gray-700 utilities in dark theme.

  40. Control the border color of an element to blue-400 using the focus:border-blue-400 utilities on focus.

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

  42. Control the text color of an element to gray-400 using the text-gray-400 utilities.

  43. Control the text color of an element to blue-500 on focus using the focus:text-blue-500 utilities.

  44. Control the text color of an element to blue-500 on hover using the hover:text-blue-500 utilities.

  45. Control the background color of an element to blue-500 using the bg-blue-500 utilities.

  46. Control the background color of an element to blue-400 using the hover:bg-blue-400 utilities on hover.

  47. Control the background color of an element to blue-400 using the focus:bg-blue-400 utilities on focus.

  48. Control the text color of an element to blue-500 using the text-blue-500 utilities.

Conclusion

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