- Published on
6 Steps To Make A Twiiter Clone layout With Tailwind CSS Like A Pro In Under An Hour

- What is Tailwind CSS?
- The description of Twiiter Clone layout ui component
- Why use Tailwind CSS to create a Twiiter Clone layout ui component?
- The preview of Twiiter Clone layout ui component
- The source code of Twiiter Clone layout ui component
- How to create a Twiiter Clone layout with Tailwind CSS?
- Install tailwind css of verion 2.0.3
- All the unility class needed to create a Twiiter Clone layout component
- 66 steps to create a Twiiter Clone layout 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 Twiiter Clone layout ui component
Just playing around tailwind to build basic twitter layout
Why use Tailwind CSS to create a Twiiter Clone layout ui component?
- It can make the building process of Twiiter Clone layout ui component faster and more easily.
- Enables building complex responsive layouts and components freely.
- Minimum lines of CSS code in Twiiter Clone layout component file.
The preview of Twiiter Clone layout ui component
Free download of the Twiiter Clone layout's source code
The source code of Twiiter Clone layout ui component
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css"
href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="css/tailwind.css">
<title>Twitter Like App </title>
</head>
<body class="antialiased h-screen">
<div class="flex">
<!-- Menu -->
<div class="w-1/4 border-r bg-white hidden md:block">
<div class="py-2 pl-28 space-y-3 sticky top-0">
<div class="block px-2 text-blue-400 text-3xl">
<span><i class="fa fa-twitter "></i></span>
</div>
<div class="block py-2 px-2 text-blue-400 text-2xl">
<i class="fa fa-home mr-2"></i><span class="font-extrabold"> Home</span>
</div>
<div
class="block group py-2 px-2 text-gray-700 hover:bg-blue-100 rounded-3xl hover:text-blue-400 text-2xl">
<i class="fa fa-hashtag mr-2"></i> <span
class="font-semibold group-hover:text-blue-400 text-black"> Explore</span>
</div>
<div
class="block group py-2 px-2 text-gray-700 hover:bg-blue-100 rounded-3xl hover:text-blue-400 text-2xl">
<i class="fa fa-bell-o mr-4 "></i><span
class="font-semibold group-hover:text-blue-400 text-black">Notifications</span>
</div>
<div
class="block group py-2 px-2 text-gray-700 hover:bg-blue-100 rounded-3xl hover:text-blue-400 text-2xl">
<i class="fa fa-envelope-o mr-4"></i> <span
class="font-semibold group-hover:text-blue-400 text-black"> Messages</span>
</div>
<div
class="block group py-2 px-2 text-gray-700 hover:bg-blue-100 rounded-3xl hover:text-blue-400 text-2xl">
<i class="fa fa-bookmark-o mr-4"></i> <span
class="font-semibold group-hover:text-blue-400 text-black"> Bookmark</span>
</div>
<div
class="block group py-2 px-2 text-gray-700 hover:bg-blue-100 rounded-3xl hover:text-blue-400 text-2xl">
<i class="fa fa-list-ol mr-4 "></i> <span
class="font-semibold group-hover:text-blue-400 text-black"> Lists</span>
</div>
<div
class="block group py-2 px-2 text-gray-700 hover:bg-blue-100 rounded-3xl hover:text-blue-400 text-2xl">
<i class="fa fa-user-circle mr-4"></i> <span
class="font-semibold group-hover:text-blue-400 text-black"> Profile</span>
</div>
<div
class="block group py-2 px-2 text-gray-700 hover:bg-blue-100 rounded-3xl hover:text-blue-400 text-2xl">
<i class="fa fa-dot-circle-o mr-4"></i> <span
class="font-semibold group-hover:text-blue-400 text-black">More</span>
</div>
<div class="block py-3 px-2 bg-blue-400 shadow text-white text-center mr-6 font-bold rounded-3xl">
<a href="" class="inline-block ">Tweet</a>
</div>
<div
class=" block items-center justify-between flex group py-2 px-2 mr-6 text-gray-700 hover:bg-blue-100 rounded-full hover:text-blue-400">
<div class="flex space-x-1">
<img class="rounded-full"
src="https://pbs.twimg.com/profile_images/1005827060617695233/XiH6yzF5_normal.jpg" alt=""
srcset="">
<div>
<p class="font-semibold text-gray-800">MaseruMetro</p>
<span class="text-gray-600">@MaseruMetro</span>
</div>
</div>
<div class="text-lg">
<i class="fa fa-ellipsis-h"></i>
</div>
</div>
</div>
</div>
<!-- News Content -->
<div class="md:w-2/5 border-r bg-gray-50">
<nav class="flex py-4 px-4 sticky top-0 border-b bg-white items-center justify-between">
<h1 class="font-extrabold tracking-wide text-lg ">Home</h1>
<div class="text-blue-400">
<i class="fa fa-dot-circle-o"></i>
</div>
</nav>
<div class=" overflow-hidden">
<div class=" py-4 px-4 bg-white">
<div class="flex">
<div>
<img class="rounded-full border"
src="https://pbs.twimg.com/profile_images/1005827060617695233/XiH6yzF5_normal.jpg"
alt="" srcset="">
</div>
<div class="flex-1 border-b">
<input type="text" class="block w-full p-3" name="fullname"
placeholder="What's Happening ?" />
<div class="block py-2 px-2 hover:bg-blue-100 text-blue-500 mb-10 w-48 rounded-3xl">
<i class="fa fa-globe text-lg"></i> <span class="font-bold text-sm">Everyone can
reply</span>
</div>
</div>
</div>
<div class="flex pl-14 py-3 items-center justify-between">
<div class="flex text-lg items-center space-x-4 text-blue-500">
<span><i class="fa fa-hand-grab-o"></i></span>
<span><i class="fa fa-hand-lizard-o"></i></span>
<span><i class="fa fa-hand-paper-o"></i></span>
<span><i class="fa fa-hand-spock-o"></i></span>
<span><i class="fa fa-headphones"></i></span>
</div>
<div>
<a href=""
class="inline-block bg-blue-300 px-6 py-1 rounded-2xl text-white font-bold">Tweet</a>
</div>
</div>
</div>
<div class="mt-4">
<div class="py-2 px-5 bg-white">
<div class="flex items-center justify-between">
<div class="flex items-center space-x-1">
<img class="rounded-full h-14 w-14 border"
src="https://pbs.twimg.com/profile_images/1005827060617695233/XiH6yzF5_normal.jpg"
alt="" srcset="">
<div class="flex items-center space-x-1">
<div>
<h1 class="font-bold">Economist Times</h1>
</div>
<p class="text-gray-600">@EconomistTimes</p>
<span style="font-size:6px;"><i class="fa fa-circle text-gray-600"></i></span>
<span class="text-gray-600">32s</span>
</div>
</div>
<div>
<span class="text-lg text-gray-600"><i class="fa fa-ellipsis-h"></i></span>
</div>
</div>
<div class="mt-10">
<div class="border rounded-2xl">
<img class="w-full rounded-t-2xl"
src="https://pbs.twimg.com/card_img/1382577985220349954/KsDkLkN8?format=jpg&name=small"
alt="" srcset="">
<div class="p-4">
<h1 class="font-medium">Steinhoff seeks lenders’ nod to list EU discount retailer
</h1>
<p class="text-sm font-medium text-gray-600">Mail, Business Times, RDM and more,
plus live business, politics and markets news all day</p>
<i class="text-gray-500 text-xs font-semibold">economist.com</i>
</div>
</div>
</div>
<div class="flex mt-2 space-x-10 text-gray-500 justify-evenly">
<span><i class="fa fa-comment-o"></i></span>
<span><i class="fa fa-recycle"></i>1</span>
<span><i class="fa fa-hand-paper-o"></i></span>
<span><i class="fa fa-hand-spock-o"></i></span>
</div>
</div>
</div>
<div class="mt-4">
<div class="py-2 px-5 bg-white">
<div class="flex items-center justify-between">
<div class="flex items-center space-x-1">
<img class="rounded-full h-14 w-14 border"
src="https://pbs.twimg.com/profile_images/1005827060617695233/XiH6yzF5_normal.jpg"
alt="" srcset="">
<div class="flex items-center space-x-1">
<div>
<h1 class="font-bold">Economist Times</h1>
</div>
<p class="text-gray-600">@EconomistTimes</p>
<span style="font-size:6px;"><i class="fa fa-circle text-gray-600"></i></span>
<span class="text-gray-600">32s</span>
</div>
</div>
<div>
<span class="text-lg text-gray-600"><i class="fa fa-ellipsis-h"></i></span>
</div>
</div>
<div class="mt-10">
<div class="border rounded-2xl">
<img class="w-full rounded-t-2xl"
src="https://pbs.twimg.com/card_img/1382577985220349954/KsDkLkN8?format=jpg&name=small"
alt="" srcset="">
<div class="p-4">
<h1 class="font-medium">Steinhoff seeks lenders’ nod to list EU discount retailer
</h1>
<p class="text-sm font-medium text-gray-600">Mail, Business Times, RDM and more,
plus live business, politics and markets news all day</p>
<i class="text-gray-500 text-xs font-semibold">economist.com</i>
</div>
</div>
</div>
<div class="flex mt-2 space-x-10 text-gray-500 justify-evenly">
<span><i class="fa fa-comment-o"></i></span>
<span><i class="fa fa-recycle"></i>1</span>
<span><i class="fa fa-hand-paper-o"></i></span>
<span><i class="fa fa-hand-spock-o"></i></span>
</div>
</div>
</div>
<div class="mt-4">
<div class="py-2 px-5 bg-white">
<div class="flex items-center justify-between">
<div class="flex items-center space-x-1">
<img class="rounded-full h-14 w-14 border"
src="https://pbs.twimg.com/profile_images/1005827060617695233/XiH6yzF5_normal.jpg"
alt="" srcset="">
<div class="flex items-center space-x-1">
<div>
<h1 class="font-bold">Economist Times</h1>
</div>
<p class="text-gray-600">@EconomistTimes</p>
<span style="font-size:6px;"><i class="fa fa-circle text-gray-600"></i></span>
<span class="text-gray-600">32s</span>
</div>
</div>
<div>
<span class="text-lg text-gray-600"><i class="fa fa-ellipsis-h"></i></span>
</div>
</div>
<div class="mt-10">
<div class="border rounded-2xl">
<img class="w-full rounded-t-2xl"
src="https://pbs.twimg.com/card_img/1382577985220349954/KsDkLkN8?format=jpg&name=small"
alt="" srcset="">
<div class="p-4">
<h1 class="font-medium">Steinhoff seeks lenders’ nod to list EU discount retailer
</h1>
<p class="text-sm font-medium text-gray-600">Mail, Business Times, RDM and more,
plus live business, politics and markets news all day</p>
<i class="text-gray-500 text-xs font-semibold">economist.com</i>
</div>
</div>
</div>
<div class="flex mt-2 space-x-10 text-gray-500 justify-evenly">
<span><i class="fa fa-comment-o"></i></span>
<span><i class="fa fa-recycle"></i>1</span>
<span><i class="fa fa-hand-paper-o"></i></span>
<span><i class="fa fa-hand-spock-o"></i></span>
</div>
</div>
</div>
</div>
</div>
<!-- Follow and trends -->
<div class="flex-1 py-4 pl-10 pr-28 space-y-4 bg-white hidden md:block">
<div class="sticky top-0 bg-white pb-2">
<input type="text"
class="block text-black border border-grey-light bg-gray-200 w-full py-2 pl-3 rounded-3xl"
name="fullname" placeholder="Search Twiiter" />
</div>
<div class="">
<div class="block bg-gray-50 py-2 px-2 rounded-2xl shadow-sm">
<p class="font-extrabold text-lg">Trends for you</p>
</div>
</div>
<div class="block bg-gray-50 py-2 sticky top-16 px-2 rounded-2xl shadow-sm">
<div class="border-b py-2">
<h1 class="font-extrabold text-lg">Who to follow</h1>
</div>
<div
class=" block border-b items-center justify-between flex group py-4 px-2 mr-6 text-gray-700 hover:text-blue-400">
<div class="flex space-x-4">
<img class="rounded-full"
src="https://pbs.twimg.com/profile_images/1005827060617695233/XiH6yzF5_normal.jpg" alt=""
srcset="">
<div>
<p class="font-semibold text-gray-800">MaseruMetro</p>
<span class="text-gray-600">@MaseruMetro</span>
</div>
</div>
<div>
<a href=""
class="inline-block border border-blue-400 text-blue-400 py-1 px-4 rounded-full font-bold">Follow</a>
</div>
</div>
<div
class=" block border-b items-center justify-between flex group py-4 px-2 mr-6 text-gray-700 hover:text-blue-400">
<div class="flex space-x-4">
<img class="rounded-full"
src="https://pbs.twimg.com/profile_images/1005827060617695233/XiH6yzF5_normal.jpg" alt=""
srcset="">
<div>
<p class="font-semibold text-gray-800">MaseruMetro</p>
<span class="text-gray-600">@MaseruMetro</span>
</div>
</div>
<div>
<a href=""
class="inline-block border border-blue-400 text-blue-400 py-1 px-4 rounded-full font-bold">Follow</a>
</div>
</div>
<div
class=" block border-b items-center justify-between flex group py-4 px-2 mr-6 text-gray-700 hover:text-blue-400">
<div class="flex space-x-4">
<img class="rounded-full"
src="https://pbs.twimg.com/profile_images/1005827060617695233/XiH6yzF5_normal.jpg" alt=""
srcset="">
<div>
<p class="font-semibold text-gray-800">MaseruMetro</p>
<span class="text-gray-600">@MaseruMetro</span>
</div>
</div>
<div>
<a href=""
class="inline-block border border-blue-400 text-blue-400 py-1 px-4 rounded-full font-bold">Follow</a>
</div>
</div>
<div
class=" block border-b items-center justify-between flex group py-4 px-2 mr-6 text-gray-700 hover:text-blue-400">
<div class="flex space-x-4">
<img class="rounded-full"
src="https://pbs.twimg.com/profile_images/1005827060617695233/XiH6yzF5_normal.jpg" alt=""
srcset="">
<div>
<p class="font-semibold text-gray-800">MaseruMetro</p>
<span class="text-gray-600">@MaseruMetro</span>
</div>
</div>
<div>
<a href=""
class="inline-block border border-blue-400 text-blue-400 py-1 px-4 rounded-full font-bold">Follow</a>
</div>
</div>
<div class="px-2">
<p class="text-sm font-bold text-blue-400 py-3">See more</p>
</div>
</div>
</div>
</div>
</body>
</html>
How to create a Twiiter Clone layout with Tailwind CSS?
Install tailwind css of verion 2.0.3
Use the script
html tag to import the script of Tailwind CSS of the version 2.0.3
<script src="https://cdn.tailwindcss.com"></script>
All the unility class needed to create a Twiiter Clone layout component
h-screen
flex
w-1/4
border-r
bg-white
hidden
md:block
py-2
pl-28
sticky
top-0
block
px-2
text-blue-400
text-3xl
text-2xl
mr-2
text-gray-700
hover:bg-blue-100
hover:text-blue-400
group-hover:text-blue-400
text-black
mr-4
py-3
bg-blue-400
text-white
text-center
mr-6
inline-block
text-gray-800
text-gray-600
text-lg
md:w-2/5
bg-gray-50
py-4
px-4
border-b
overflow-hidden
flex-1
w-full
p-3
text-blue-500
mb-10
w-48
text-sm
pl-14
bg-blue-300
px-6
py-1
mt-4
px-5
h-14
w-14
mt-10
p-4
text-gray-500
text-xs
mt-2
pl-10
pr-28
pb-2
border-grey-light
bg-gray-200
pl-3
top-16
border-blue-400
66 steps to create a Twiiter Clone layout component with Tailwind CSS
Use
h-screen
to make an element span the entire height of the viewport.Use
flex
to create a block-level flex container.Use
w-1/4
to set an element to a fixed width(1/4).Control the border color of an element to r using the
border-r
utilities.Control the background color of an element to white using the
bg-white
utilities.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.Control the vertical padding of an element to 0.5rem using the
py-2
utilities.Set the left padding of an element to 7rem using the
pl-28
utilities classUse
sticky
to position an element asrelative
until it crosses a specified threshold, then treat it as fixed until its parent is off screen.Use the
top-0
utilities to set the top position of a positioned element to 0rem.Use
inline
utilities to put the element on its own line and fill its parent.Control the horizontal padding of an element to 0.5rem using the
px-2
utilities.Control the text color of an element to blue-400 using the
text-blue-400
utilities.Control the text color of an element to 3xl using the
text-3xl
utilities.Control the text color of an element to 2xl using the
text-2xl
utilities.Control the margin on right side of an element to 0.5rem using the
mr-2
utilities.Control the text color of an element to gray-700 using the
text-gray-700
utilities.Control the background color of an element to blue-100 using the
hover:bg-blue-100
utilities on hover.Control the text color of an element to blue-400 on hover using the
hover:text-blue-400
utilities.Control the text color of an element to blue-400undefined using the
group-hover:text-blue-400
utilities.Control the text color of an element to black using the
text-black
utilities.Control the margin on right side of an element to 1rem using the
mr-4
utilities.Control the vertical padding of an element to 0.75rem using the
py-3
utilities.Control the background color of an element to blue-400 using the
bg-blue-400
utilities.Control the text color of an element to white using the
text-white
utilities.Control the text color of an element to center using the
text-center
utilities.Control the margin on right side of an element to 1.5rem using the
mr-6
utilities.Use
inline-block
utilities to wrap the element to prevent the text inside from extending beyond its parent.Control the text color of an element to gray-800 using the
text-gray-800
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 lg using the
text-lg
utilities.Use
md:w-2/5
to set an element to a fixed width(2/5) at only medium screen sizes.Control the background color of an element to gray-50 using the
bg-gray-50
utilities.Control the vertical padding of an element to 1rem using the
py-4
utilities.Control the horizontal padding of an element to 1rem using the
px-4
utilities.Control the border color of an element to b using the
border-b
utilities.Use
overflow-hidden
to clip any content within an element that overflows the bounds of that element.Use
flex
to create a block-level flex container.Use
w-full
to set an element to a 100% based width.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-500 using the
text-blue-500
utilities.Control the margin on bottom side of an element to 2.5rem using the
mb-10
utilities.Use
w-48
to set an element to a fixed width(12rem).Control the text color of an element to sm using the
text-sm
utilities.Set the left padding of an element to 3.5rem using the
pl-14
utilities classControl the background color of an element to blue-300 using the
bg-blue-300
utilities.Control the horizontal padding of an element to 1.5rem using the
px-6
utilities.Control the vertical padding of an element to 0.25rem using the
py-1
utilities.Control the margin on top side of an element to 1rem using the
mt-4
utilities.Control the horizontal padding of an element to 1.25rem using the
px-5
utilities.Use
h-14
to set an element to a fixed height(3.5rem).Use
w-14
to set an element to a fixed width(3.5rem).Control the margin on top side of an element to 2.5rem using the
mt-10
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 gray-500 using the
text-gray-500
utilities.Control the text color of an element to xs using the
text-xs
utilities.Control the margin on top side of an element to 0.5rem using the
mt-2
utilities.Set the left padding of an element to 2.5rem using the
pl-10
utilities classControl the padding on right side of an element to 7rem using the
pr-28
utilities.Control the padding on bottom side of an element to 0.5rem using the
pb-2
utilities.Control the border color of an element to grey-light using the
border-grey-light
utilities.Control the background color of an element to gray-200 using the
bg-gray-200
utilities.Set the left padding of an element to 0.75rem using the
pl-3
utilities classUse the
top-16
utilities to set the top position of a positioned element to 4rem.Control the border color of an element to blue-400 using the
border-blue-400
utilities.
Conclusion
The above is a step-by-step tutorial on how to use Tailwind CSS to create a Twiiter Clone layout components, learn and follow along to implement your own components.