- Published on
Ultimate Guide: Build A Instagram Clone With Tailwind CSS

- What is Tailwind CSS?
- The description of Instagram clone ui component
- Why use Tailwind CSS to create a Instagram clone ui component?
- The preview of Instagram clone ui component
- The source code of Instagram clone ui component
- How to create a Instagram clone with Tailwind CSS?
- Install tailwind css of verion 1.7.0
- All the unility class needed to create a Instagram clone component
- 63 steps to create a Instagram clone 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 Instagram clone ui component
Pc only
Why use Tailwind CSS to create a Instagram clone ui component?
- It can make the building process of Instagram clone ui component faster and more easily.
- Enables building complex responsive layouts and components freely.
- Minimum lines of CSS code in Instagram clone component file.
The preview of Instagram clone ui component
Free download of the Instagram clone's source code
The source code of Instagram clone ui component
<!-- This is an example component -->
<html lang="en" class="bg-gray-900">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=">
<title>Instagram clone</title>
</head>
<style>
.container {
max-width: 935px;
}
.right .first{
/* comment out for tailwindcomponents.com
left: 1126px;
*/
}
</style>
<body class="relative bg-gray-200 h-full">
<nav class="border-b py-3 sticky top-0 bg-white z-50">
<div class="container mx-auto flex justify-between">
<div class="logo">
<h1 class="font-bold text-xl">
<img src="https://www.instagram.com/static/images/web/mobile_nav_type_logo.png/735145cfe0a4.png" alt="">
</h1>
</div>
<div class="search-bar">
<input type="text" placeholder="seach" class="border px-1 text-sm bg-gray-200 rounded-sm" />
</div>
<div class="icons flex">
<div class="home-icon mr-6">
<svg aria-label="Home" class="_8-yf5 " fill="#262626" height="22" viewBox="0 0 48 48" width="22">
<path d="M45.5 48H30.1c-.8 0-1.5-.7-1.5-1.5V34.2c0-2.6-2.1-4.6-4.6-4.6s-4.6 2.1-4.6 4.6v12.3c0 .8-.7 1.5-1.5 1.5H2.5c-.8 0-1.5-.7-1.5-1.5V23c0-.4.2-.8.4-1.1L22.9.4c.6-.6 1.6-.6 2.1 0l21.5 21.5c.3.3.4.7.4 1.1v23.5c.1.8-.6 1.5-1.4 1.5z"></path>
</svg>
</div>
<div class="like-icon mr-6">
<svg aria-label="Direct" class="_8-yf5 " fill="#262626" height="22" viewBox="0 0 48 48" width="22">
<path d="M47.8 3.8c-.3-.5-.8-.8-1.3-.8h-45C.9 3.1.3 3.5.1 4S0 5.2.4 5.7l15.9 15.6 5.5 22.6c.1.6.6 1 1.2 1.1h.2c.5 0 1-.3 1.3-.7l23.2-39c.4-.4.4-1 .1-1.5zM5.2 6.1h35.5L18 18.7 5.2 6.1zm18.7 33.6l-4.4-18.4L42.4 8.6 23.9 39.7z"></path>
</svg>
</div>
<div class="dm-icon mr-6">
<svg aria-label="Find People" class="_8-yf5 " fill="#262626" height="22" viewBox="0 0 48 48" width="22">
<path clip-rule="evenodd" d="M24 0C10.8 0 0 10.8 0 24s10.8 24 24 24 24-10.8 24-24S37.2 0 24 0zm0 45C12.4 45 3 35.6 3 24S12.4 3 24 3s21 9.4 21 21-9.4 21-21 21zm10.2-33.2l-14.8 7c-.3.1-.6.4-.7.7l-7 14.8c-.3.6-.2 1.3.3 1.7.3.3.7.4 1.1.4.2 0 .4 0 .6-.1l14.8-7c.3-.1.6-.4.7-.7l7-14.8c.3-.6.2-1.3-.3-1.7-.4-.5-1.1-.6-1.7-.3zm-7.4 15l-5.5-5.5 10.5-5-5 10.5z" fill-rule="evenodd"></path>
</svg>
</div>
<div class="compas-icon mr-6">
<svg aria-label="Activity Feed" class="_8-yf5 " fill="#262626" height="22" viewBox="0 0 48 48" width="22">
<path d="M34.6 6.1c5.7 0 10.4 5.2 10.4 11.5 0 6.8-5.9 11-11.5 16S25 41.3 24 41.9c-1.1-.7-4.7-4-9.5-8.3-5.7-5-11.5-9.2-11.5-16C3 11.3 7.7 6.1 13.4 6.1c4.2 0 6.5 2 8.1 4.3 1.9 2.6 2.2 3.9 2.5 3.9.3 0 .6-1.3 2.5-3.9 1.6-2.3 3.9-4.3 8.1-4.3m0-3c-4.5 0-7.9 1.8-10.6 5.6-2.7-3.7-6.1-5.5-10.6-5.5C6 3.1 0 9.6 0 17.6c0 7.3 5.4 12 10.6 16.5.6.5 1.3 1.1 1.9 1.7l2.3 2c4.4 3.9 6.6 5.9 7.6 6.5.5.3 1.1.5 1.6.5.6 0 1.1-.2 1.6-.5 1-.6 2.8-2.2 7.8-6.8l2-1.8c.7-.6 1.3-1.2 2-1.7C42.7 29.6 48 25 48 17.6c0-8-6-14.5-13.4-14.5z"></path>
</svg>
</div>
<div class="profile-icon">
<img alt="u__graphics's profile picture" width="22px" height="22px" class="_6q-tv" data-testid="user-avatar" draggable="false" src="https://instagram.fcrk1-1.fna.fbcdn.net/v/t51.2885-19/44884218_345707102882519_2446069589734326272_n.jpg?_nc_ht=instagram.fcrk1-1.fna.fbcdn.net&_nc_ohc=RLYRR3IenIMAX-3KydC&oh=23629c61452b7e40fcc30b2658f4a74a&oe=5F96310F&ig_cache_key=YW5vbnltb3VzX3Byb2ZpbGVfcGlj.2">
</div>
</div>
</div>
</nav>
<div class="page-content pt-6 h-full">
<div class="container mx-auto flex h-full">
<div class="left w-8/12 pr-4">
<div class="stories bg-white p-5 rounded border border-gray-400 flex mb-6">
<div class="storie-item flex flex-col mr-6">
<div class="rounded-full p-1 bg-gradient-to-r from-purple-400 via-pink-500 to-red-500">
<div class="rounded-full bg-white wrapper overflow-hidden h-16 w-16">
<img src="https://scontent-nrt1-1.cdninstagram.com/v/t51.2885-19/s150x150/20635165_1942203892713915_5464937638928580608_a.jpg?_nc_ht=scontent-nrt1-1.cdninstagram.com&_nc_ohc=JK-0WwYKXBgAX-mFP6I&oh=e0d86b1c4be3cea94e341f18e17905b3&oe=5F94C764" class="-full h-full object-contain p-2" alt="">
</div>
</div>
<div class="user-name text-center pt-1">
<span class="text-gray-700 text-sm">
apple
</span>
</div>
</div>
<div class="storie-item flex flex-col mr-6">
<div class="rounded-full p-1 bg-gradient-to-r from-purple-400 via-pink-500 to-red-500">
<div class="rounded-full bg-white wrapper overflow-hidden h-16 w-16">
<img src="https://scontent-nrt1-1.cdninstagram.com/v/t51.2885-19/s150x150/119515245_239175997499686_2853342285794408974_n.jpg?_nc_ht=scontent-nrt1-1.cdninstagram.com&_nc_ohc=KDVS6kR76AYAX9tg6_K&oh=81ca965572b7c99626143aacdd38c3ce&oe=5F94DE5B" class="-full h-full object-contain p-2" alt="">
</div>
</div>
<div class="user-name text-center pt-1">
<span class="text-gray-700 text-sm">
google
</span>
</div>
</div>
</div>
<div class="feeds">
<div class="feed-wrapper mb-4">
<div class="feed-item border border-gray-400 rounded bg-white">
<div class="header border-b p-4 flex justify-between items-center">
<div class="left flex flex-row items-center">
<div class="user-img h-10 w-10 border rounded-full overflow-hidden mr-4">
<img alt="nike's profile picture" class="_6q-tv" data-testid="user-avatar" draggable="false" src="https://scontent-nrt1-1.cdninstagram.com/v/t51.2885-19/s150x150/20635165_1942203892713915_5464937638928580608_a.jpg?_nc_ht=scontent-nrt1-1.cdninstagram.com&_nc_ohc=JK-0WwYKXBgAX-mFP6I&oh=e0d86b1c4be3cea94e341f18e17905b3&oe=5F94C764">
</div>
<div class="user-name-and-place flex flex-col">
<span class="text-sm font-bold">apple</span>
<span class="text-xs font-light text-gray-900">Chiapas, Mexico</span>
</div>
</div>
<div class="right">
<svg aria-label="More options" class="_8-yf5 " fill="#262626" height="16" viewBox="0 0 48 48" width="16">
<circle clip-rule="evenodd" cx="8" cy="24" fill-rule="evenodd" r="4.5"></circle>
<circle clip-rule="evenodd" cx="24" cy="24" fill-rule="evenodd" r="4.5"></circle>
<circle clip-rule="evenodd" cx="40" cy="24" fill-rule="evenodd" r="4.5"></circle>
</svg>
</div>
</div>
<div class="feed-img">
<img src="https://images.unsplash.com/photo-1512054502232-10a0a035d672?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=800&q=80" alt="">
</div>
<div class="card-footer p-4">
<div class="top">
<div class="icons flex flex-row justify-between items-center">
<div class="left flex flex-row">
<div class="like mr-4">
<svg aria-label="Like" class="_8-yf5 " fill="#262626" height="24" viewBox="0 0 48 48" width="24">
<path d="M34.6 6.1c5.7 0 10.4 5.2 10.4 11.5 0 6.8-5.9 11-11.5 16S25 41.3 24 41.9c-1.1-.7-4.7-4-9.5-8.3-5.7-5-11.5-9.2-11.5-16C3 11.3 7.7 6.1 13.4 6.1c4.2 0 6.5 2 8.1 4.3 1.9 2.6 2.2 3.9 2.5 3.9.3 0 .6-1.3 2.5-3.9 1.6-2.3 3.9-4.3 8.1-4.3m0-3c-4.5 0-7.9 1.8-10.6 5.6-2.7-3.7-6.1-5.5-10.6-5.5C6 3.1 0 9.6 0 17.6c0 7.3 5.4 12 10.6 16.5.6.5 1.3 1.1 1.9 1.7l2.3 2c4.4 3.9 6.6 5.9 7.6 6.5.5.3 1.1.5 1.6.5.6 0 1.1-.2 1.6-.5 1-.6 2.8-2.2 7.8-6.8l2-1.8c.7-.6 1.3-1.2 2-1.7C42.7 29.6 48 25 48 17.6c0-8-6-14.5-13.4-14.5z"></path>
</svg>
</div>
<div class="comment mr-4">
<svg aria-label="Comment" class="_8-yf5 " fill="#262626" height="24" viewBox="0 0 48 48" width="24">
<path clip-rule="evenodd" d="M47.5 46.1l-2.8-11c1.8-3.3 2.8-7.1 2.8-11.1C47.5 11 37 .5 24 .5S.5 11 .5 24 11 47.5 24 47.5c4 0 7.8-1 11.1-2.8l11 2.8c.8.2 1.6-.6 1.4-1.4zm-3-22.1c0 4-1 7-2.6 10-.2.4-.3.9-.2 1.4l2.1 8.4-8.3-2.1c-.5-.1-1-.1-1.4.2-1.8 1-5.2 2.6-10 2.6-11.4 0-20.6-9.2-20.6-20.5S12.7 3.5 24 3.5 44.5 12.7 44.5 24z" fill-rule="evenodd"></path>
</svg>
</div>
<div class="share">
<svg aria-label="Share Post" class="_8-yf5 " fill="#262626" height="24" viewBox="0 0 48 48" width="24">
<path d="M47.8 3.8c-.3-.5-.8-.8-1.3-.8h-45C.9 3.1.3 3.5.1 4S0 5.2.4 5.7l15.9 15.6 5.5 22.6c.1.6.6 1 1.2 1.1h.2c.5 0 1-.3 1.3-.7l23.2-39c.4-.4.4-1 .1-1.5zM5.2 6.1h35.5L18 18.7 5.2 6.1zm18.7 33.6l-4.4-18.4L42.4 8.6 23.9 39.7z"></path>
</svg>
</div>
</div>
<div class="right">
<div class="save">
<svg aria-label="Save" class="_8-yf5 " fill="#262626" height="24" viewBox="0 0 48 48" width="24">
<path d="M43.5 48c-.4 0-.8-.2-1.1-.4L24 29 5.6 47.6c-.4.4-1.1.6-1.6.3-.6-.2-1-.8-1-1.4v-45C3 .7 3.7 0 4.5 0h39c.8 0 1.5.7 1.5 1.5v45c0 .6-.4 1.2-.9 1.4-.2.1-.4.1-.6.1zM24 26c.8 0 1.6.3 2.2.9l15.8 16V3H6v39.9l15.8-16c.6-.6 1.4-.9 2.2-.9z"></path>
</svg>
</div>
</div>
</div>
<div class="likes mt-1">
<span class="font-bold text-sm">
122,780 likes
</span>
</div>
<div class="caption text-sm mt-3">
<b>apple </b>
new Iphone release ✨
</div>
<div class="post-date mt-1">
<span class="text-xs text-gray-900">
1 minute ago
</span>
</div>
</div>
<div class="bottom border-t pt-3 mt-3">
<div class="wrapper flex">
<input type="text" class="text-sm h-10 w-full outline-none focus:outline-none w-10/12" placeholder="Add a comment">
<button class="text-blue-500 opacity-75 w-2/12 text-right font-bold">post</button>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="right w-4/12 h-screen overflow-visible h-full">
<div class="first fixed pl-4 w-full" style="top:85px; max-width: 293px;">
<div class="profile flex items-center p-3 mb-4">
<div class="avatar rounded-full overflow-hidden mr-3">
<img width="56px" height="56px" src="https://scontent-ort2-1.cdninstagram.com/v/t51.2885-19/44884218_345707102882519_2446069589734326272_n.jpg?_nc_ht=scontent-ort2-1.cdninstagram.com&_nc_ohc=RLYRR3IenIMAX_WuH3u&oh=f63257aee4bcbf147d7a26c7da5b3467&oe=5F96310F" alt="">
</div>
<div class="user-name ">
<span class="text-lg font-semibold text-gray-700">u__graphics</span>
<span class="text-sm text-gray-600 block">Ugraphics</span>
</div>
</div>
<div class="suggestion-users">
<div class="title flex w-full justify-between text-sm">
<div class="left">
<h1 class="font-bold">Suggestions For You</h1>
</div>
<div class="right">
<span>See All</span>
</div>
</div>
<div class="users-wrapper mt-4 flex w-full justify-between items-center">
<div class="user-item flex flex-row pl-2">
<div class="user-img h-10 w-10 border rounded-full overflow-hidden mr-4">
<img alt="realdonaldtrump's profile picture" class="" src="https://scontent-nrt1-1.cdninstagram.com/v/t51.2885-19/s150x150/23823676_515039535523575_7479748231031685120_n.jpg?_nc_ht=scontent-nrt1-1.cdninstagram.com&_nc_ohc=zLTqJ5i4bawAX9aEwSk&oh=3bd3cf886021fc3ad74a9258163f319b&oe=5F93487B">
</div>
<div class="user-name flex flex-col ">
<span class="text-sm font-semibold">realdonaldtrump</span>
<span class="text-xs -mt-1 text-gray-700">populer</span>
</div>
</div>
<a href="" class="follow text-blue-600 text-sm font-semibold">follow</a>
</div>
<div class="users-wrapper mt-4 flex w-full justify-between items-center">
<div class="user-item flex flex-row pl-2">
<div class="user-img h-10 w-10 border rounded-full overflow-hidden mr-4">
<img alt="shinzoabe's profile picture" class="_6q-tv" data-testid="user-avatar" draggable="false" src="https://scontent-nrt1-1.cdninstagram.com/v/t51.2885-19/s150x150/28765771_2034399086813186_5509661386784899072_n.jpg?_nc_ht=scontent-nrt1-1.cdninstagram.com&_nc_ohc=qheOj6mJM98AX83my9F&oh=8a8985205ad5a19ae0905a3c3a77906b&oe=5F93F87C">
</div>
<div class="user-name flex flex-col ">
<span class="text-sm font-semibold">shinzoabe</span>
<span class="text-xs -mt-1 text-gray-700">populer</span>
</div>
</div>
<a href="" class="follow text-blue-600 text-sm font-semibold">follow</a>
</div>
<div class="users-wrapper mt-4 flex w-full justify-between items-center">
<div class="user-item flex flex-row pl-2">
<div class="user-img h-10 w-10 border rounded-full overflow-hidden mr-4">
<img alt="nike's profile picture" class="_6q-tv" data-testid="user-avatar" draggable="false" src="https://scontent-nrt1-1.cdninstagram.com/v/t51.2885-19/s150x150/26155970_1584552474997482_4541081815552622592_n.jpg?_nc_ht=scontent-nrt1-1.cdninstagram.com&_nc_ohc=f5mhOmP7WT0AX9kw3Eh&oh=fd2a3ba71bee8608cda04d04196746b8&oe=5F94C3CE">
</div>
<div class="user-name flex flex-col ">
<span class="text-sm font-semibold">nike</span>
<span class="text-xs -mt-1 text-gray-700">populer</span>
</div>
</div>
<a href="" class="follow text-blue-600 text-sm font-semibold">follow</a>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>
How to create a Instagram clone with Tailwind CSS?
Install tailwind css of verion 1.7.0
Use the link
html tag to import the stylesheet of Tailwind CSS of the version 1.7.0
<link href=https://unpkg.com/[email protected]/dist/tailwind.min.css rel="stylesheet">
All the unility class needed to create a Instagram clone component
bg-gray-900
relative
bg-gray-200
h-full
border-b
py-3
sticky
top-0
bg-white
z-50
mx-auto
flex
text-xl
px-1
text-sm
mr-6
pt-6
w-8/12
pr-4
p-5
border-gray-400
mb-6
flex-col
p-1
bg-gradient-to-r
overflow-hidden
h-16
w-16
p-2
text-center
pt-1
text-gray-700
mb-4
p-4
flex-row
h-10
w-10
mr-4
text-xs
text-gray-900
mt-1
mt-3
border-t
pt-3
w-full
w-10/12
text-blue-500
w-2/12
text-right
w-4/12
h-screen
overflow-visible
fixed
pl-4
p-3
mr-3
text-lg
text-gray-600
block
mt-4
pl-2
-mt-1
text-blue-600
63 steps to create a Instagram clone component with Tailwind CSS
Control the background color of an element to gray-900 using the
bg-gray-900
utilities.Use
relative
to position an element according to the normal flow of the document.Control the background color of an element to gray-200 using the
bg-gray-200
utilities.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 border color of an element to b using the
border-b
utilities.Control the vertical padding of an element to 0.75rem using the
py-3
utilities.Use
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.Control the background color of an element to white using the
bg-white
utilities.Control the stack order (or three-dimensional positioning) of an element to 50 in Tailwind, regardless of order it has been displayed, using the
z-50
utilities.Control the horizontal margin of an element to auto using the
mx-auto
utilities.Use
flex
to create a block-level flex container.Control the text color of an element to xl using the
text-xl
utilities.Control the horizontal padding of an element to 0.25rem using the
px-1
utilities.Control the text color of an element to sm using the
text-sm
utilities.Control the margin on right side of an element to 1.5rem using the
mr-6
utilities.Control the padding on top side of an element to 1.5rem using the
pt-6
utilities.Use
w-8/12
to set an element to a fixed width(8/12).Control the padding on right side of an element to 1rem using the
pr-4
utilities.Control the padding on all sides of an element to 1.25rem using the
p-5
utilities.Control the border color of an element to gray-400 using the
border-gray-400
utilities.Control the margin on bottom side of an element to 1.5rem using the
mb-6
utilities.Use
flex
to create a block-level flex container.Control the padding on all sides of an element to 0.25rem using the
p-1
utilities.Control the background color of an element to gradient-to-r using the
bg-gradient-to-r
utilities.Use
overflow-hidden
to clip any content within an element that overflows the bounds of that element.Use
h-16
to set an element to a fixed height(4rem).Use
w-16
to set an element to a fixed width(4rem).Control the padding on all sides of an element to 0.5rem using the
p-2
utilities.Control the text color of an element to center using the
text-center
utilities.Control the padding on top side of an element to 0.25rem using the
pt-1
utilities.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 1rem using the
mb-4
utilities.Control the padding on all sides of an element to 1rem using the
p-4
utilities.Use
flex
to create a block-level flex container.Use
h-10
to set an element to a fixed height(2.5rem).Use
w-10
to set an element to a fixed width(2.5rem).Control the margin on right side of an element to 1rem using the
mr-4
utilities.Control the text color of an element to xs using the
text-xs
utilities.Control the text color of an element to gray-900 using the
text-gray-900
utilities.Control the margin on top side of an element to 0.25rem using the
mt-1
utilities.Control the margin on top side of an element to 0.75rem using the
mt-3
utilities.Control the border color of an element to t using the
border-t
utilities.Control the padding on top side of an element to 0.75rem using the
pt-3
utilities.Use
w-full
to set an element to a 100% based width.Use
w-10/12
to set an element to a fixed width(10/12).Control the text color of an element to blue-500 using the
text-blue-500
utilities.Use
w-2/12
to set an element to a fixed width(2/12).Control the text color of an element to right using the
text-right
utilities.Use
w-4/12
to set an element to a fixed width(4/12).Use
h-screen
to make an element span the entire height of the viewport.Use
overflow-visible
to prevent content within an element from being clipped. Note that any content that overflows the bounds of the element will then be visible.Use
fixed
to position an element relative to the browser window.Set the left padding of an element to 1rem using the
pl-4
utilities classControl the padding on all sides of an element to 0.75rem using the
p-3
utilities.Control the margin on right side of an element to 0.75rem using the
mr-3
utilities.Control the text color of an element to lg using the
text-lg
utilities.Control the text color of an element to gray-600 using the
text-gray-600
utilities.Use
inline
utilities to put the element on its own line and fill its parent.Control the margin on top side of an element to 1rem using the
mt-4
utilities.Set the left padding of an element to 0.5rem using the
pl-2
utilities classControl the margin on top side of an element to -0.25rem using the
-mt-1
utilities.Control the text color of an element to blue-600 using the
text-blue-600
utilities.
Conclusion
The above is a step-by-step tutorial on how to use Tailwind CSS to create a Instagram clone components, learn and follow along to implement your own components.