Last Updated: January 15, 2026
🎯 Introduction
Have you ever wondered how TikTok’s dynamic feed and swipe-based video UI are built? Whether you’re a beginner web developer or learning app cloning for your portfolio, this tutorial will guide you step-by-step to build a TikTok-like template using HTML, CSS, and minimal JavaScript. By the end, you’ll have a working prototype to expand into a full app using frameworks like React Native or Flutter.
🔧 Why Build a TikTok Clone Template?
✅ Practice front-end and responsive design skills
✅ Understand vertical scroll and video autoplay logic
✅ Build portfolio projects that showcase trending app UI clones
✅ Prepare for freelance or internship projects
📝 Prerequisites
Before starting this TikTok-like template tutorial, ensure you have:
- Basic understanding of HTML, CSS, JavaScript
- A code editor (VS Code recommended)
- Live Server extension (for real-time preview)
- Sample video files (MP4 format) in your project folder
💻 Step 1. Setup Your Project Structure
Create a new folder named tiktok-clone-template and add the following files:
pgsqlCopyEdit/tiktok-clone-template
├── index.html
├── style.css
└── script.js
└── videos/
├── video1.mp4
├── video2.mp4
└── video3.mp4
🗂️ Step 2. HTML Structure (index.html)
Here is your base HTML code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>TikTok Clone UI</title>
<link rel="stylesheet" href="style.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css" />
</head>
<body>
<!-- Top bar -->
<header>
<h1>TikTok</h1>
<div class="header-icons">
<i class="fas fa-search"></i>
</div>
</header>
<!-- Video Feed -->
<div class="video-feed">
<div class="video-container">
<video src="videos/video1.mp4" class="video" muted loop></video>
<div class="overlay">
<div class="info">
<h4>@user1</h4>
<p>Beautiful travel vlog #travel #life</p>
</div>
<div class="actions">
<img src="profile1.jpg" class="profile-pic" />
<i class="fas fa-heart"></i>
<i class="fas fa-comment"></i>
<i class="fas fa-share"></i>
<i class="fas fa-ellipsis-h"></i>
</div>
</div>
</div>
<div class="video-container">
<video src="videos/video2.mp4" class="video" muted loop></video>
<div class="overlay">
<div class="info">
<h4>@user2</h4>
<p>Amazing dance moves! #dance #fun</p>
</div>
<div class="actions">
<img src="profile2.jpg" class="profile-pic" />
<i class="fas fa-heart"></i>
<i class="fas fa-comment"></i>
<i class="fas fa-share"></i>
<i class="fas fa-ellipsis-h"></i>
</div>
</div>
</div>
</div>
<!-- Bottom navigation bar -->
<nav>
<i class="fas fa-home"></i>
<i class="fas fa-search"></i>
<i class="fas fa-plus-square"></i>
<i class="fas fa-inbox"></i>
<i class="fas fa-user"></i>
</nav>
<script src="script.js"></script>
</body>
</html>
🎨 Step 3. Styling (style.css)
This CSS will make your videos full-screen with swipe-like vertical scroll:
body, html {
margin: 0;
padding: 0;
height: 100%;
overflow-y: scroll;
background: #000;
font-family: sans-serif;
}
header {
position: fixed;
top: 0;
width: 100%;
height: 50px;
background: rgba(0,0,0,0.5);
color: white;
display: flex;
justify-content: space-between;
align-items: center;
padding: 0 15px;
z-index: 10;
}
nav {
position: fixed;
bottom: 0;
width: 100%;
height: 50px;
background: rgba(0,0,0,0.8);
display: flex;
justify-content: space-around;
align-items: center;
color: white;
z-index: 10;
}
nav i {
font-size: 20px;
}
.video-feed {
scroll-snap-type: y mandatory;
margin-top: 50px;
margin-bottom: 50px;
}
.video-container {
position: relative;
width: 100%;
height: 100vh;
scroll-snap-align: start;
}
video {
width: 100%;
height: 100%;
object-fit: cover;
}
.overlay {
position: absolute;
bottom: 60px;
left: 10px;
right: 10px;
display: flex;
justify-content: space-between;
color: white;
padding: 0 10px;
}
.info {
max-width: 70%;
}
.actions {
display: flex;
flex-direction: column;
align-items: center;
gap: 15px;
}
.actions i {
font-size: 24px;
}
.profile-pic {
width: 40px;
height: 40px;
border-radius: 50%;
border: 2px solid white;
}
⚙️ Step 4. JavaScript (script.js)
Add autoplay on viewport scroll using Intersection Observer:
jsCopyEditconst videos = document.querySelectorAll("video");
const options = {
root: null,
rootMargin: "0px",
threshold: 0.8
};
const callback = (entries) => {
entries.forEach(entry => {
if (entry.isIntersecting) {
entry.target.play();
} else {
entry.target.pause();
}
});
};
const observer = new IntersectionObserver(callback, options);
videos.forEach(video => {
observer.observe(video);
});
✅ Step 5. Testing Your TikTok Clone
- Open index.html using Live Server in VS Code.
- Scroll vertically. Each video will autoplay when it enters 80% of the viewport and pause when out of view, replicating TikTok’s feed behavior.
🚀 Step 6. Expand Your Project (Next Steps)
To build a full TikTok-like app:
- Integrate a backend (PHP, Node.js, Firebase) for video uploads
- Build with React or React Native for real mobile app deployment
- Add user authentication and like/comment features
- Integrate FFmpeg for video compression and thumbnail generation
💡 Final Thoughts
This TikTok-like template tutorial equips you with essential modern front-end skills. It’s a perfect mini-project to showcase in your developer portfolio or internship applications. Clone popular app UIs to:
✅ Understand real-world design patterns
✅ Improve JavaScript logic and CSS layout skills
✅ Prepare for freelance gigs building short video platforms

Read more – Free Custom YouTube Embed code generator

