- Published on
Most Effective Ways To Make A Login Page With Tailwind CSS

- What is Tailwind CSS?
- The description of Login Page ui component
- Why use Tailwind CSS to make a Login Page ui component?
- The preview of Login Page ui component
- The source code of Login Page ui component
- How to make a Login Page with Tailwind CSS?
- Install tailwind css of verion 1.2.0
- All the unility class needed to make a Login Page component
- 62 steps to make a Login Page 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 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("https://demos.creative-tim.com/tailwindcss-starter-project/static/media/register_bg_2.2fee0b50.png"); 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
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.Use
w-full
to set an element to a 100% based width.Use the
top-0
utilities to set the top position of a positioned element to 0rem.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 background color of an element to gray-900 using the
bg-gray-900
utilities.Control the horizontal margin of an element to auto using the
mx-auto
utilities.Control the horizontal padding of an element to 1rem using the
px-4
utilities.Use
flex
to create a block-level flex container.Use
lg:w-4/12
to set an element to a fixed width(4/12) at only large screen sizes.Control the padding on top side of an element to 8rem using the
pt-32
utilities.Use
relative
to position an element according to the normal flow of the document.Use
flex
to create a block-level flex container.Set the minimum width/height of an element using the
min-w-0
utilities.Control the margin on bottom side of an element to 1.5rem using the
mb-6
utilities.Control the background color of an element to gray-300 using the
bg-gray-300
utilities.Control the border color of an element to 0rem using the
border-0
utilities.Control the margin on bottom side of an element to 0rem using the
mb-0
utilities.Control the horizontal padding of an element to 1.5rem using the
px-6
utilities.Control the vertical padding of an element to 1.5rem using the
py-6
utilities.Control the text color of an element to center using the
text-center
utilities.Control the margin on bottom side of an element to 0.75rem using the
mb-3
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 sm using the
text-sm
utilities.Control the background color of an element to white using the
bg-white
utilities.Control the background color of an element to gray-100 using the
active:bg-gray-100
utilities on active.Control the text color of an element to gray-800 using the
text-gray-800
utilities.Control the vertical padding of an element to 0.5rem using the
py-2
utilities.Control the margin on right side of an element to 0.5rem using the
mr-2
utilities.Control the margin on bottom side of an element to 0.25rem using the
mb-1
utilities.Use
inline-flex
to create an inline flex container that flows with text.Control the text color of an element to xs using the
text-xs
utilities.Use
w-5
to set an element to a fixed width(1.25rem).Control the margin on right side of an element to 0.25rem using the
mr-1
utilities.Control the margin on top side of an element to 1.5rem using the
mt-6
utilities.Control the border color of an element to b-1 using the
border-b-1
utilities.Control the border color of an element to gray-400 using the
border-gray-400
utilities.Use
flex
to create a block-level flex container.Control the horizontal padding of an element to 2.5rem at only large screen sizes using the
lg:px-10
utilities.Control the vertical padding of an element to 2.5rem using the
py-10
utilities.Control the padding on top side of an element to 0rem using the
pt-0
utilities.Control the text color of an element to gray-500 using the
text-gray-500
utilities.Use
inline
utilities to put the element on its own line and fill its parent.Control the text color of an element to gray-700 using the
text-gray-700
utilities.Control the margin on bottom side of an element to 0.5rem using the
mb-2
utilities.Control the horizontal padding of an element to 0.75rem using the
px-3
utilities.Control the vertical padding of an element to 0.75rem using the
py-3
utilities.Control the margin on left side of an element to 0.25rem using the
ml-1
utilities.Use
h-5
to set an element to a fixed height(1.25rem).Control the margin on left side of an element to 0.5rem using the
ml-2
utilities.Control the text color of an element to white using the
text-white
utilities.Control the background color of an element to gray-700 using the
active:bg-gray-700
utilities on active.Use
flex
to create a block-level flex container.Use
w-1/2
to set an element to a fixed width(1/2).Control the text color of an element to gray-300 using the
text-gray-300
utilities.Control the text color of an element to right using the
text-right
utilities.Use the
bottom-0
utilities to set the bottom position of a positioned element to 0rem.Control the padding on bottom side of an element to 1.5rem using the
pb-6
utilities.Control the border color of an element to gray-700 using the
border-gray-700
utilities.Use
md:w-4/12
to set an element to a fixed width(4/12) at only medium screen sizes.Control the vertical padding of an element to 0.25rem using the
py-1
utilities.Control the text color of an element to gray-400 on hover using the
hover:text-gray-400
utilities.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.