- Published on
Build A Login & Register Page (Doulingo.com) With Tailwind CSS Like A Pro With The Help Of These 6 Tips

- What is Tailwind CSS?
- The description of Login & Register Page (Doulingo.com) ui component
- Why use Tailwind CSS to make a Login & Register Page (Doulingo.com) ui component?
- The preview of Login & Register Page (Doulingo.com) ui component
- The source code of Login & Register Page (Doulingo.com) ui component
- How to make a Login & Register Page (Doulingo.com) with Tailwind CSS?
- Install tailwind css of verion 3.0.18
- All the unility class needed to make a Login & Register Page (Doulingo.com) component
- 45 steps to make a Login & Register Page (Doulingo.com) 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 & Register Page (Doulingo.com) ui component
Login and registration page based on duolingo.com
Why use Tailwind CSS to make a Login & Register Page (Doulingo.com) ui component?
- It can make the building process of Login & Register Page (Doulingo.com) ui component faster and more easily.
- Enables building complex responsive layouts and components freely.
- Minimum lines of CSS code in Login & Register Page (Doulingo.com) component file.
The preview of Login & Register Page (Doulingo.com) ui component
Free download of the Login & Register Page (Doulingo.com)'s source code
The source code of Login & Register Page (Doulingo.com) ui component
<script defer src="https://unpkg.com/[email protected]/dist/cdn.min.js"></script>
<!-- page -->
<main class="relative min-h-screen w-full bg-white">
<!-- component -->
<div class="p-6" x-data="app">
<!-- header -->
<header class="flex w-full justify-between">
<svg class="h-7 w-7 cursor-pointer text-gray-400 hover:text-gray-300" fill="currentColor"
viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" stroke="currentColor">
<path stroke-width="1" fill-rule="evenodd"
d="M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z"
clip-rule="evenodd"></path>
</svg>
<!-- buttons -->
<div>
<button type="button" @click="isLoginPage = false" x-show="isLoginPage"
class="rounded-2xl border-b-2 border-b-gray-300 bg-white py-3 px-4 font-bold text-blue-500 ring-2 ring-gray-300 hover:bg-gray-200 active:translate-y-[0.125rem] active:border-b-gray-200">
LOGIN
</button>
<button type="button" @click="isLoginPage = true" x-show="!isLoginPage"
class="rounded-2xl border-b-2 border-b-gray-300 bg-white py-3 px-4 font-bold text-blue-500 ring-2 ring-gray-300 hover:bg-gray-200 active:translate-y-[0.125rem] active:border-b-gray-200">
SIGN UP
</button>
</div>
</header>
<section
class="absolute top-1/2 left-1/2 mx-auto max-w-sm -translate-x-1/2 -translate-y-1/2 transform space-y-4 text-center">
<!-- register content -->
<div x-show="isLoginPage" class="space-y-4">
<header class="mb-3 text-2xl font-bold">Create your profile</header>
<div class="w-full rounded-2xl bg-gray-50 px-4 ring-2 ring-gray-200 focus-within:ring-blue-400">
<input type="text" placeholder="Age"
class="my-3 w-full border-none bg-transparent outline-none focus:outline-none" />
</div>
<div class="w-full rounded-2xl bg-gray-50 px-4 ring-2 ring-gray-200 focus-within:ring-blue-400">
<input type="text" placeholder="Name (optional)"
class="my-3 w-full border-none bg-transparent outline-none focus:outline-none" />
</div>
<div class="w-full rounded-2xl bg-gray-50 px-4 ring-2 ring-gray-200 focus-within:ring-blue-400">
<input type="text" placeholder="Email"
class="my-3 w-full border-none bg-transparent outline-none focus:outline-none" />
</div>
<div class="w-full rounded-2xl bg-gray-50 px-4 ring-2 ring-gray-200 focus-within:ring-blue-400">
<input type="password" placeholder="Password"
class="my-3 w-full border-none bg-transparent outline-none focus:outline-none" />
</div>
<button
class="w-full rounded-2xl border-b-4 border-b-blue-600 bg-blue-500 py-3 font-bold text-white hover:bg-blue-400 active:translate-y-[0.125rem] active:border-b-blue-400">
CREATE ACCOUNT
</button>
</div>
<!-- login content -->
<div x-show="!isLoginPage" class="space-y-4">
<header class="mb-3 text-2xl font-bold">Log in</header>
<div class="w-full rounded-2xl bg-gray-50 px-4 ring-2 ring-gray-200 focus-within:ring-blue-400">
<input type="text" placeholder="Email or username"
class="my-3 w-full border-none bg-transparent outline-none focus:outline-none" />
</div>
<div
class="flex w-full items-center space-x-2 rounded-2xl bg-gray-50 px-4 ring-2 ring-gray-200 focus-within:ring-blue-400">
<input type="password" placeholder="Password"
class="my-3 w-full border-none bg-transparent outline-none" />
<a href="#" class="font-medium text-gray-400 hover:text-gray-500">FORGOT?</a>
</div>
<button
class="w-full rounded-2xl border-b-4 border-b-blue-600 bg-blue-500 py-3 font-bold text-white hover:bg-blue-400 active:translate-y-[0.125rem] active:border-b-blue-400">
LOG IN
</button>
</div>
<div class="flex items-center space-x-4">
<hr class="w-full border border-gray-300" />
<div class="font-semibold text-gray-400">OR</div>
<hr class="w-full border border-gray-300" />
</div>
<footer>
<div class="grid grid-cols-2 gap-4">
<a href="#"
class="rounded-2xl border-b-2 border-b-gray-300 bg-white py-2.5 px-4 font-bold text-blue-700 ring-2 ring-gray-300 hover:bg-gray-200 active:translate-y-[0.125rem] active:border-b-gray-200">FACEBOOK</a>
<a href="#"
class="rounded-2xl border-b-2 border-b-gray-300 bg-white py-2.5 px-4 font-bold text-blue-500 ring-2 ring-gray-300 hover:bg-gray-200 active:translate-y-[0.125rem] active:border-b-gray-200">GOOGLE</a>
</div>
<div class="mt-8 text-sm text-gray-400">
By signing in to ********, you agree to our
<a href="#" class="font-medium text-gray-500">Terms</a> and
<a href="#" class="font-medium text-gray-500">Privacy Policy</a>.
</div>
</footer>
</section>
</div>
</main>
<script>
document.addEventListener("alpine:init", () => {
Alpine.data("app", () => ({
isLoginPage: true,
}));
});
</script>
How to make a Login & Register Page (Doulingo.com) 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 make a Login & Register Page (Doulingo.com) component
relative
min-h-screen
w-full
bg-white
p-6
flex
h-7
w-7
text-gray-400
hover:text-gray-300
border-b-2
border-b-gray-300
py-3
px-4
text-blue-500
hover:bg-gray-200
active:border-b-gray-200
absolute
top-1/2
left-1/2
mx-auto
max-w-sm
text-center
mb-3
text-2xl
bg-gray-50
my-3
border-none
bg-transparent
border-b-4
border-b-blue-600
bg-blue-500
text-white
hover:bg-blue-400
active:border-b-blue-400
hover:text-gray-500
border-gray-300
grid
grid-cols-2
gap-4
py-2.5
text-blue-700
mt-8
text-sm
text-gray-500
45 steps to make a Login & Register Page (Doulingo.com) component with Tailwind CSS
Use
relative
to position an element according to the normal flow of the document.Set the minimum width/height of an element using the
min-h-screen
utilities.Use
w-full
to set an element to a 100% based width.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.Use
flex
to create a block-level flex container.Use
h-7
to set an element to a fixed height(1.75rem).Use
w-7
to set an element to a fixed width(1.75rem).Control the text color of an element to gray-400 using the
text-gray-400
utilities.Control the text color of an element to gray-300 on hover using the
hover:text-gray-300
utilities.Control the border color of an element to b-2 using the
border-b-2
utilities.Control the border color of an element to b-gray-300 using the
border-b-gray-300
utilities.Control the vertical padding of an element to 0.75rem using the
py-3
utilities.Control the horizontal padding of an element to 1rem using the
px-4
utilities.Control the text color of an element to blue-500 using the
text-blue-500
utilities.Control the background color of an element to gray-200 using the
hover:bg-gray-200
utilities on hover.Control the border color of an element to b-gray-200 using the
active:border-b-gray-200
utilities on active.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
top-1/2
utilities to set the top position of a positioned element to 1/2.Use the
left-1/2
utilities to set the left position of a positioned element to 1/2.Control the horizontal margin of an element to auto using the
mx-auto
utilities.Set the maximum width/height of an element using the
max-w-sm
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 2xl using the
text-2xl
utilities.Control the background color of an element to gray-50 using the
bg-gray-50
utilities.Control the vertical margin of an element to 0.75rem using the
my-3
utilities.Control the border color of an element to none using the
border-none
utilities.Control the background color of an element to transparent using the
bg-transparent
utilities.Control the border color of an element to b-4 using the
border-b-4
utilities.Control the border color of an element to b-blue-600 using the
border-b-blue-600
utilities.Control the background color of an element to blue-500 using the
bg-blue-500
utilities.Control the text color of an element to white using the
text-white
utilities.Control the background color of an element to blue-400 using the
hover:bg-blue-400
utilities on hover.Control the border color of an element to b-blue-400 using the
active:border-b-blue-400
utilities on active.Control the text color of an element to gray-500 on hover using the
hover:text-gray-500
utilities.Control the border color of an element to gray-300 using the
border-gray-300
utilities.Use
grid
to create a grid container.Use
grid
to create a grid container.To specify the width between columns, you can use the
gap-4
utilities.Control the vertical padding of an element to 2.5 using the
py-2.5
utilities.Control the text color of an element to blue-700 using the
text-blue-700
utilities.Control the margin on top side of an element to 2rem using the
mt-8
utilities.Control the text color of an element to sm using the
text-sm
utilities.Control the text color of an element to gray-500 using the
text-gray-500
utilities.
Conclusion
The above is a step-by-step tutorial on how to use Tailwind CSS to make a Login & Register Page (Doulingo.com) components, learn and follow along to implement your own components.