- Published on
How To Build A Sign up / Login boxes With Tailwind CSS From Scratch

- What is Tailwind CSS?
- The description of Sign up / Login boxes ui component
- Why use Tailwind CSS to build a Sign up / Login boxes ui component?
- The preview of Sign up / Login boxes ui component
- The source code of Sign up / Login boxes ui component
- How to build a Sign up / Login boxes with Tailwind CSS?
- Install tailwind css of verion 0.7.0
- All the unility class needed to build a Sign up / Login boxes component
- 45 steps to build a Sign up / Login boxes 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 Sign up / Login boxes ui component
Some clear ui/ux inspirations
Why use Tailwind CSS to build a Sign up / Login boxes ui component?
- It can make the building process of Sign up / Login boxes ui component faster and more easily.
- Enables building complex responsive layouts and components freely.
- Minimum lines of CSS code in Sign up / Login boxes component file.
The preview of Sign up / Login boxes ui component
Free download of the Sign up / Login boxes's source code
The source code of Sign up / Login boxes ui component
<div class="w-full h-screen bg-grey-lighter">
<form class="container flex flex-col lg:flex-row justify-center lg:justify-between font-sans mx-auto py-8">
<div class="w-full lg:w-1/3 px-2 mb-6 lg:mb-0">
<div class="bg-white shadow rounded-lg">
<div class="border-b border-grey-lighter p-4">
<h3 class="text-grey-darkest">
Get access
</h3>
</div>
<div class="p-4">
<div class="mb-4">
<label for="email_2" class="uppercase text-sm tracking-wide font-semibold text-grey-darker px-2">
Email
</label>
<input type="text" id="email_2" class="no-appearance bg-grey-lighter w-full leading-normal py-2 px-3 rounded border-b border-red-light mt-2 focus:outline-none">
</div>
<div class="mb-4">
<div class="flex justify-between items-center px-2">
<label for="reason" class="uppercase text-sm tracking-wide font-semibold text-grey-darker">
Reason
</label>
<a href="#" class="no-underline text-grey-darker">
<i class="fas fa-info-circle"></i>
</a>
</div>
<div class="relative mt-2">
<select class="block appearance-none w-full bg-grey-lighter border-b border-grey-light text-grey-darker py-3 px-4 pr-8 rounded leading-tight focus:outline-none" id="reason">
<option>Select a reason</option>
<option>Beta access</option>
<option>Lorem ipsum</option>
</select>
<div class="pointer-events-none absolute pin-y pin-r flex items-center px-2 text-grey-darker">
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20"><path d="M9.293 12.95l.707.707L15.657 8l-1.414-1.414L10 10.828 5.757 6.586 4.343 8z"/></svg>
</div>
</div>
</div>
<div class="flex justify-between items-center pt-4 mb-4" data-toggle="toggler" data-target="#subscribe">
<div id="subscribe" class="bg-grey rounded-full pl-px pr-4 py-px cursor-pointer">
<div class="w-4 h-4 bg-white rounded-full"></div>
</div>
<label for="subscribe" class="text-grey-darker text-sm cursor-pointer select-none">
Allow to subscribe to our newsletter
</label>
</div>
</div>
<button type="submit" class="uppercase font-bold w-full bg-green-light text-lg text-green-lightest rounded-b-lg p-3 cursor-not-allowed opacity-50" disabled>
Send request
</button>
</div>
</div>
<div class="w-full lg:w-1/3 px-2 mb-6 lg:mb-0">
<div class="bg-white shadow rounded-lg">
<div class="border-b border-grey-lighter p-4">
<h3 class="text-grey-darkest">
Access to
</h3>
</div>
<div class="p-4">
<div class="mb-4">
<label for="email" class="uppercase text-sm tracking-wide font-semibold text-grey-darker px-2">
Email
</label>
<input type="email" id="email" class="no-appearance bg-grey-lighter w-full leading-normal py-2 px-3 rounded border-b border-grey-light mt-2 focus:outline-none">
</div>
<div class="mb-4">
<label for="password" class="uppercase text-sm tracking-wide font-semibold text-grey-darker px-2">
Password
<small class="lowercase tracking-normal">
<a href="#" class="no-underline text-blue">
forgot?
</a>
</small>
</label>
<input type="password" id="password" class="no-appearance bg-grey-lighter w-full leading-normal py-2 px-3 rounded border-b border-grey-light mt-2 focus:outline-none">
</div>
</div>
<button type="submit" class="uppercase font-bold w-full bg-blue-light text-lg text-blue-lightest rounded-b-lg p-3">
Access
</button>
</div>
</div>
</form>
</div>
How to build a Sign up / Login boxes with Tailwind CSS?
Install tailwind css of verion 0.7.0
Use the link
html tag to import the stylesheet of Tailwind CSS of the version 0.7.0
<link href=https://unpkg.com/[email protected]/dist/tailwind.min.css rel="stylesheet">
All the unility class needed to build a Sign up / Login boxes component
w-full
h-screen
bg-grey-lighter
flex
flex-col
lg:flex-row
mx-auto
py-8
lg:w-1/3
px-2
mb-6
lg:mb-0
bg-white
border-b
border-grey-lighter
p-4
text-grey-darkest
mb-4
text-sm
text-grey-darker
py-2
px-3
border-red-light
mt-2
relative
block
border-grey-light
py-3
px-4
pr-8
absolute
h-4
w-4
pt-4
bg-grey
pl-px
pr-4
py-px
bg-green-light
text-lg
text-green-lightest
p-3
text-blue
bg-blue-light
text-blue-lightest
45 steps to build a Sign up / Login boxes component with Tailwind CSS
Use
w-full
to set an element to a 100% based width.Use
h-screen
to make an element span the entire height of the viewport.Control the background color of an element to grey-lighter using the
bg-grey-lighter
utilities.Use
flex
to create a block-level flex container.Use
flex
to create a block-level flex container.Use
flex
to create a block-level flex container at only large screen sizes.Control the horizontal margin of an element to auto using the
mx-auto
utilities.Control the vertical padding of an element to 2rem using the
py-8
utilities.Use
lg:w-1/3
to set an element to a fixed width(1/3) at only large screen sizes.Control the horizontal padding of an element to 0.5rem using the
px-2
utilities.Control the margin on bottom side of an element to 1.5rem using the
mb-6
utilities.Control the margin on bottom side of an element to 0rem at only large screen sizes using the
lg:mb-0
utilities.Control the background color of an element to white using the
bg-white
utilities.Control the border color of an element to b using the
border-b
utilities.Control the border color of an element to grey-lighter using the
border-grey-lighter
utilities.Control the padding on all sides of an element to 1rem using the
p-4
utilities.Control the text color of an element to grey-darkest using the
text-grey-darkest
utilities.Control the margin on bottom side of an element to 1rem using the
mb-4
utilities.Control the text color of an element to sm using the
text-sm
utilities.Control the text color of an element to grey-darker using the
text-grey-darker
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 border color of an element to red-light using the
border-red-light
utilities.Control the margin on top side of an element to 0.5rem using the
mt-2
utilities.Use
relative
to position an element according to the normal flow of the document.Use
inline
utilities to put the element on its own line and fill its parent.Control the border color of an element to grey-light using the
border-grey-light
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 padding on right side of an element to 2rem using the
pr-8
utilities.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
h-4
to set an element to a fixed height(1rem).Use
w-4
to set an element to a fixed width(1rem).Control the padding on top side of an element to 1rem using the
pt-4
utilities.Control the background color of an element to grey using the
bg-grey
utilities.Set the left padding of the element to px using the
pl-px
utilities classControl the padding on right side of an element to 1rem using the
pr-4
utilities.Control the vertical padding of an element to px using the
py-px
utilities.Control the background color of an element to green-light using the
bg-green-light
utilities.Control the text color of an element to lg using the
text-lg
utilities.Control the text color of an element to green-lightest using the
text-green-lightest
utilities.Control the padding on all sides of an element to 0.75rem using the
p-3
utilities.Control the text color of an element to blue using the
text-blue
utilities.Control the background color of an element to blue-light using the
bg-blue-light
utilities.Control the text color of an element to blue-lightest using the
text-blue-lightest
utilities.
Conclusion
The above is a step-by-step tutorial on how to use Tailwind CSS to build a Sign up / Login boxes components, learn and follow along to implement your own components.