- Published on
Learn How To Make A Login Page With Tailwind CSS from the Pros

- What is Tailwind CSS?
- The description of Login page ui component
- Why use Tailwind CSS to build a Login page ui component?
- The preview of Login page ui component
- The source code of Login page ui component
- How to build a Login page with Tailwind CSS?
- Install tailwind css of verion 2.2.19
- All the unility class needed to build a Login page component
- 41 steps to build 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
Social login page, find more on tailus.io/blocks/login
Why use Tailwind CSS to build 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
<div class="relative py-16 bg-gradient-to-br from-sky-50 to-gray-200">
<div class="relative container m-auto px-6 text-gray-500 md:px-12 xl:px-40">
<div class="m-auto md:w-8/12 lg:w-6/12 xl:w-6/12">
<div class="rounded-xl bg-white shadow-xl">
<div class="p-6 sm:p-16">
<div class="space-y-4">
<img src="https://tailus.io/sources/blocks/social/preview/images/icon.svg" loading="lazy" class="w-10" alt="tailus logo">
<h2 class="mb-8 text-2xl text-cyan-900 font-bold">Sign in to unlock the <br> best of Tailus.</h2>
</div>
<div class="mt-16 grid space-y-4">
<button class="group h-12 px-6 border-2 border-gray-300 rounded-full transition duration-300
hover:border-blue-400 focus:bg-blue-50 active:bg-blue-100">
<div class="relative flex items-center space-x-4 justify-center">
<img src="https://tailus.io/sources/blocks/social/preview/images/google.svg" class="absolute left-0 w-5" alt="google logo">
<span class="block w-max font-semibold tracking-wide text-gray-700 text-sm transition duration-300 group-hover:text-blue-600 sm:text-base">Continue with Google</span>
</div>
</button>
<button class="group h-12 px-6 border-2 border-gray-300 rounded-full transition duration-300
hover:border-blue-400 focus:bg-blue-50 active:bg-blue-100">
<div class="relative flex items-center space-x-4 justify-center">
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="absolute left-0 w-5 text-gray-700" viewBox="0 0 16 16">
<path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.012 8.012 0 0 0 16 8c0-4.42-3.58-8-8-8z"/>
</svg>
<span class="block w-max font-semibold tracking-wide text-gray-700 text-sm transition duration-300 group-hover:text-blue-600 sm:text-base">Continue with Github</span>
</div>
</button>
<button class="group h-12 px-6 border-2 border-gray-300 rounded-full transition duration-300
hover:border-blue-400 focus:bg-blue-50 active:bg-blue-100">
<div class="relative flex items-center space-x-4 justify-center">
<img src="https://upload.wikimedia.org/wikipedia/en/0/04/Facebook_f_logo_%282021%29.svg" class="absolute left-0 w-5" alt="Facebook logo">
<span class="block w-max font-semibold tracking-wide text-gray-700 text-sm transition duration-300 group-hover:text-blue-600 sm:text-base">Continue with Facebook</span>
</div>
</button>
</div>
<div class="mt-32 space-y-4 text-gray-600 text-center sm:-mb-8">
<p class="text-xs">By proceeding, you agree to our <a href="#" class="underline">Terms of Use</a> and confirm you have read our <a href="#" class="underline">Privacy and Cookie Statement</a>.</p>
<p class="text-xs">This site is protected by reCAPTCHA and the <a href="#" class="underline">Google Privacy Policy</a> and <a href="#" class="underline">Terms of Service</a> apply.</p>
</div>
</div>
</div>
</div>
</div>
</div>
How to build a Login page with Tailwind CSS?
Install tailwind css of verion 2.2.19
Use the script
html tag to import the script of Tailwind CSS of the version 2.2.19
<script src="https://cdn.tailwindcss.com"></script>
All the unility class needed to build a Login page component
relative
py-16
bg-gradient-to-br
m-auto
px-6
text-gray-500
md:px-12
xl:px-40
md:w-8/12
lg:w-6/12
xl:w-6/12
bg-white
p-6
sm:p-16
w-10
mb-8
text-2xl
text-cyan-900
mt-16
grid
h-12
border-2
border-gray-300
hover:border-blue-400
focus:bg-blue-50
active:bg-blue-100
flex
absolute
left-0
w-5
block
w-max
text-gray-700
text-sm
group-hover:text-blue-600
sm:text-base
mt-32
text-gray-600
text-center
sm:-mb-8
text-xs
41 steps to build a Login page component with Tailwind CSS
Use
relative
to position an element according to the normal flow of the document.Control the vertical padding of an element to 4rem using the
py-16
utilities.Control the background color of an element to gradient-to-br using the
bg-gradient-to-br
utilities.Control the margin on all sides of an element to auto using the
m-auto
utilities.Control the horizontal padding of an element to 1.5rem using the
px-6
utilities.Control the text color of an element to gray-500 using the
text-gray-500
utilities.Control the horizontal padding of an element to 3rem at only medium screen sizes using the
md:px-12
utilities.Control the horizontal padding of an element to 10rem at only extremely large screen sizes using the
xl:px-40
utilities.Use
md:w-8/12
to set an element to a fixed width(8/12) at only medium screen sizes.Use
lg:w-6/12
to set an element to a fixed width(6/12) at only large screen sizes.Use
xl:w-6/12
to set an element to a fixed width(6/12) at only extremely large screen sizes.Control the background color of an element to white using the
bg-white
utilities.Control the padding on all sides of an element to 1.5rem using the
p-6
utilities.Control the padding on all sides of an element to 4rem at only small screen sizes using the
sm:p-16
utilities.Use
w-10
to set an element to a fixed width(2.5rem).Control the margin on bottom side of an element to 2rem using the
mb-8
utilities.Control the text color of an element to 2xl using the
text-2xl
utilities.Control the text color of an element to cyan-900 using the
text-cyan-900
utilities.Control the margin on top side of an element to 4rem using the
mt-16
utilities.Use
grid
to create a grid container.Use
h-12
to set an element to a fixed height(3rem).Control the border color of an element to 0.5rem using the
border-2
utilities.Control the border color of an element to gray-300 using the
border-gray-300
utilities.Control the border color of an element to blue-400 using the
hover:border-blue-400
utilities on hover.Control the background color of an element to blue-50 using the
focus:bg-blue-50
utilities on focus.Control the background color of an element to blue-100 using the
active:bg-blue-100
utilities on active.Use
flex
to create a block-level flex container.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 the
left-0
utilities to set the left position of a positioned element to 0rem.Use
w-5
to set an element to a fixed width(1.25rem).Use
inline
utilities to put the element on its own line and fill its parent.Use
w-max
to set an element to a fixed width(max).Control the text color of an element to gray-700 using the
text-gray-700
utilities.Control the text color of an element to sm using the
text-sm
utilities.Control the text color of an element to blue-600undefined using the
group-hover:text-blue-600
utilities.Control the text color of an element to base at only small screen sizes using the
sm:text-base
utilities.Control the margin on top side of an element to 8rem using the
mt-32
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 center using the
text-center
utilities.Control the margin on bottom side of an element to -2rem at only small screen sizes using the
sm:-mb-8
utilities.Control the text color of an element to xs using the
text-xs
utilities.
Conclusion
The above is a step-by-step tutorial on how to use Tailwind CSS to build a Login page components, learn and follow along to implement your own components.