- Published on
Advanced Guide: Make A Modern Login Template With Tailwind CSS

- What is Tailwind CSS?
- The description of Modern Login Template ui component
- Why use Tailwind CSS to build a Modern Login Template ui component?
- The preview of Modern Login Template ui component
- The source code of Modern Login Template ui component
- How to build a Modern Login Template with Tailwind CSS?
- Install tailwind css of verion 1.2.0
- All the unility class needed to build a Modern Login Template component
- 38 steps to build a Modern Login Template 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 Modern Login Template ui component
Why use Tailwind CSS to build a Modern Login Template ui component?
- It can make the building process of Modern Login Template ui component faster and more easily.
- Enables building complex responsive layouts and components freely.
- Minimum lines of CSS code in Modern Login Template component file.
The preview of Modern Login Template ui component
Free download of the Modern Login Template's source code
The source code of Modern Login Template ui component
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Tailwind Login Template</title>
<meta name="author" content="David Grzyb">
<meta name="description" content="">
<!-- Tailwind -->
<link href="https://unpkg.com/tailwindcss/dist/tailwind.min.css" rel="stylesheet">
<style>
@import url('https://fonts.googleapis.com/css?family=Karla:400,700&display=swap');
.font-family-karla {
font-family: karla;
}
</style>
</head>
<body class="bg-white font-family-karla h-screen">
<div class="w-full flex flex-wrap">
<!-- Login Section -->
<div class="w-full md:w-1/2 flex flex-col">
<div class="flex justify-center md:justify-start pt-12 md:pl-12 md:-mb-24">
<a href="#" class="bg-black text-white font-bold text-xl p-4">Logo</a>
</div>
<div class="flex flex-col justify-center md:justify-start my-auto pt-8 md:pt-0 px-8 md:px-24 lg:px-32">
<p class="text-center text-3xl">Welcome.</p>
<form class="flex flex-col pt-3 md:pt-8" onsubmit="event.preventDefault();">
<div class="flex flex-col pt-4">
<label for="email" class="text-lg">Email</label>
<input type="email" id="email" placeholder="[email protected]" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 mt-1 leading-tight focus:outline-none focus:shadow-outline">
</div>
<div class="flex flex-col pt-4">
<label for="password" class="text-lg">Password</label>
<input type="password" id="password" placeholder="Password" class="shadow appearance-none border rounded w-full py-2 px-3 text-gray-700 mt-1 leading-tight focus:outline-none focus:shadow-outline">
</div>
<input type="submit" value="Log In" class="bg-black text-white font-bold text-lg hover:bg-gray-700 p-2 mt-8">
</form>
<div class="text-center pt-12 pb-12">
<p>Don't have an account? <a href="register.html" class="underline font-semibold">Register here.</a></p>
</div>
</div>
</div>
<!-- Image Section -->
<div class="w-1/2 shadow-2xl">
<img class="object-cover w-full h-screen hidden md:block" src="https://source.unsplash.com/IXUM4cJynP0">
</div>
</div>
</body>
</html>
How to build a Modern Login Template 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 build a Modern Login Template component
bg-white
h-screen
w-full
flex
flex-wrap
md:w-1/2
flex-col
md:justify-start
pt-12
md:pl-12
md:-mb-24
bg-black
text-white
text-xl
p-4
my-auto
pt-8
md:pt-0
px-8
md:px-24
lg:px-32
text-center
text-3xl
pt-3
md:pt-8
pt-4
text-lg
py-2
px-3
text-gray-700
mt-1
hover:bg-gray-700
p-2
mt-8
pb-12
w-1/2
hidden
md:block
38 steps to build a Modern Login Template component with Tailwind CSS
Control the background color of an element to white using the
bg-white
utilities.Use
h-screen
to make an element span the entire height of the viewport.Use
w-full
to set an element to a 100% based width.Use
flex
to create a block-level flex container.Use
flex
to create a block-level flex container.Use
md:w-1/2
to set an element to a fixed width(1/2) at only medium screen sizes.Use
flex
to create a block-level flex container.Use
justify-start
to justify items against the start of the container’s main axis at only medium screen sizes.Control the padding on top side of an element to 3rem using the
pt-12
utilities.Adjust the left padding of an element to 3rem at only medium screen sizes using the
md:pl-12
utilities classControl the margin on bottom side of an element to -6rem at only medium screen sizes using the
md:-mb-24
utilities.Control the background color of an element to black using the
bg-black
utilities.Control the text color of an element to white using the
text-white
utilities.Control the text color of an element to xl using the
text-xl
utilities.Control the padding on all sides of an element to 1rem using the
p-4
utilities.Control the vertical margin of an element to auto using the
my-auto
utilities.Control the padding on top side of an element to 2rem using the
pt-8
utilities.Control the padding on top side of an element to 0rem at only medium screen sizes using the
md:pt-0
utilities.Control the horizontal padding of an element to 2rem using the
px-8
utilities.Control the horizontal padding of an element to 6rem at only medium screen sizes using the
md:px-24
utilities.Control the horizontal padding of an element to 8rem at only large screen sizes using the
lg:px-32
utilities.Control the text color of an element to center using the
text-center
utilities.Control the text color of an element to 3xl using the
text-3xl
utilities.Control the padding on top side of an element to 0.75rem using the
pt-3
utilities.Control the padding on top side of an element to 2rem at only medium screen sizes using the
md:pt-8
utilities.Control the padding on top side of an element to 1rem using the
pt-4
utilities.Control the text color of an element to lg using the
text-lg
utilities.Control the vertical padding of an element to 0.5rem using the
py-2
utilities.Control the horizontal padding of an element to 0.75rem using the
px-3
utilities.Control the text color of an element to gray-700 using the
text-gray-700
utilities.Control the margin on top side of an element to 0.25rem using the
mt-1
utilities.Control the background color of an element to gray-700 using the
hover:bg-gray-700
utilities on hover.Control the padding on all sides of an element to 0.5rem using the
p-2
utilities.Control the margin on top side of an element to 2rem using the
mt-8
utilities.Control the padding on bottom side of an element to 3rem using the
pb-12
utilities.Use
w-1/2
to set an element to a fixed width(1/2).Use
hidden
to set an element to display: none and remove it from the page layout.Use
inline
utilities to put the element on its own line and fill its parent at only medium screen sizes.
Conclusion
The above is a step-by-step tutorial on how to use Tailwind CSS to build a Modern Login Template components, learn and follow along to implement your own components.