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

- What is Tailwind CSS?
- The description of Login Page With Image ui component
- Why use Tailwind CSS to build a Login Page With Image ui component?
- The preview of Login Page With Image ui component
- The source code of Login Page With Image ui component
- How to build a Login Page With Image with Tailwind CSS?
- Install tailwind css of verion 3.0.18
- All the unility class needed to build a Login Page With Image component
- 48 steps to build a Login Page With Image component with Tailwind CSS
- Conclusion
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'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
Control the background color of an element to white using the
bg-white
utilities.Control the background color of an element to gray-900 using the
dark:bg-gray-900
utilities in dark theme.Use
flex
to create a block-level flex container.Use
h-screen
to make an element span the entire height of the viewport.Use
hidden
to set an element to display: none and remove it from the page layout.Control the background color of an element to cover using the
bg-cover
utilities.Use
inline
utilities to put the element on its own line and fill its parent at only large screen sizes.Use
lg:w-2/3
to set an element to a fixed width(2/3) at only large screen sizes.Use
h-full
to set an element’s height to 100% of its parent, as long as the parent has a defined height.Control the horizontal padding of an element to 5rem using the
px-20
utilities.Control the background color of an element to gray-900 using the
bg-gray-900
utilities.Control the background color of an element to opacity-40 using the
bg-opacity-40
utilities.Control the text color of an element to 4xl using the
text-4xl
utilities.Control the text color of an element to white using the
text-white
utilities.Set the maximum width/height of an element using the
max-w-xl
utilities.Control the margin on top side of an element to 0.75rem using the
mt-3
utilities.Control the text color of an element to gray-300 using the
text-gray-300
utilities.Use
w-full
to set an element to a 100% based width.Set the maximum width/height of an element using the
max-w-md
utilities.Control the horizontal padding of an element to 1.5rem using the
px-6
utilities.Control the horizontal margin of an element to auto using the
mx-auto
utilities.Use
lg:w-2/6
to set an element to a fixed width(2/6) at only large screen sizes.Use
flex
to create a block-level flex container.Control the text color of an element to center using the
text-center
utilities.Control the text color of an element to gray-700 using the
text-gray-700
utilities.Control the text color of an element to white in dark theme using the
dark:text-white
utilities.Control the text color of an element to gray-500 using the
text-gray-500
utilities.Control the text color of an element to gray-300 in dark theme using the
dark:text-gray-300
utilities.Control the margin on top side of an element to 2rem using the
mt-8
utilities.Use
inline
utilities to put the element on its own line and fill its parent.Control the margin on bottom side of an element to 0.5rem using the
mb-2
utilities.Control the text color of an element to sm using the
text-sm
utilities.Control the text color of an element to gray-600 using the
text-gray-600
utilities.Control the text color of an element to gray-200 in dark theme using the
dark:text-gray-200
utilities.Control the horizontal padding of an element to 1rem using the
px-4
utilities.Control the vertical padding of an element to 0.5rem using the
py-2
utilities.Control the margin on top side of an element to 0.5rem using the
mt-2
utilities.Control the border color of an element to gray-200 using the
border-gray-200
utilities.Control the border color of an element to gray-700 using the
dark:border-gray-700
utilities in dark theme.Control the border color of an element to blue-400 using the
focus:border-blue-400
utilities on focus.Control the margin on top side of an element to 1.5rem using the
mt-6
utilities.Control the text color of an element to gray-400 using the
text-gray-400
utilities.Control the text color of an element to blue-500 on focus using the
focus:text-blue-500
utilities.Control the text color of an element to blue-500 on hover using the
hover:text-blue-500
utilities.Control the background color of an element to blue-500 using the
bg-blue-500
utilities.Control the background color of an element to blue-400 using the
hover:bg-blue-400
utilities on hover.Control the background color of an element to blue-400 using the
focus:bg-blue-400
utilities on focus.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.