Transform basic HTML into a beautiful animated social media website
A responsive social media platform with:
Instead of writing traditional CSS in separate files, you use utility classes directly in your HTML.
We'll use Git to download our starter template. Follow these steps:
Important: If you just installed Git on Windows, close and reopen PowerShell before continuing.
Let's create a folder for our Tailwind CSS project:
Always use YOUR ACTUAL NAME in the folder name! This helps your teacher identify your work.
Now we'll get our starter code from Gitea:
Make sure to choose the "Tailwind CSS Project" template, not the Bulma one!
After creating your repository:
Make sure you're in your project folder, then:
The "Before" file
The "After" file
Open both HTML files in your text editor. You'll see:
Open starter_index.html and add these lines in the <head> section:
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Maxy - Social Platform</title>
</head>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Maxy - Social Platform</title>
<!-- TAILWIND CSS CDN -->
<script src="https://cdn.tailwindcss.com"></script>
</head>
A CDN (Content Delivery Network) hosts files and delivers them quickly from locations near users.
Advantages:
Your starter navigation looks like this:
<nav>
<div>
<div>
<a href="#">
<div>M</div>
<span>Maxy</span>
</a>
</div>
</div>
</nav>
Replace your <nav> with this (copy from index.html):
<nav class="bg-white shadow-md fixed top-0 left-0 w-full z-10">
<div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="flex justify-between h-16">
<div class="flex items-center">
<a href="#" class="flex items-center">
<div class="bg-indigo-600 text-white font-bold text-xl w-10 h-10 rounded-lg flex items-center justify-center mr-2 animate-float">
M
</div>
<span class="text-xl font-bold text-gray-800">Maxy</span>
</a>
</div>
<!-- Mobile menu and desktop navigation -->
</div>
</div>
</nav>
Simple section without responsive classes:
<section>
<div>
<div>
<!-- Left Sidebar -->
<div>...</div>
</div>
</div>
</section>
Replace with this responsive structure:
<main class="pt-20 max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
<div class="flex flex-col lg:flex-row gap-6">
<!-- Left Sidebar -->
<div class="lg:w-1/4 w-full">
<!-- Profile Card -->
</div>
<!-- Main Feed -->
<div class="lg:w-3/4 w-full">
<!-- Posts -->
</div>
</div>
</main>
Basic div structure without styling:
<div>
<div>
<div>JS</div>
<h2>John Smith</h2>
<p>@johnsmith</p>
</div>
</div>
Replace with this styled card (from index.html):
<div class="bg-white rounded-xl shadow p-5 mb-6 animate-fadeIn">
<div class="flex flex-col items-center">
<div class="bg-indigo-100 text-indigo-800 font-bold text-xl w-24 h-24 rounded-full flex items-center justify-center mb-4 animate-float">
JS
</div>
<h2 class="text-xl font-bold text-gray-800">John Smith</h2>
<p class="text-gray-500">@johnsmith</p>
<div class="flex justify-between w-full mt-6">
<div class="text-center">
<p class="text-gray-600">Posts</p>
<p class="font-bold">245</p>
</div>
<!-- More stats -->
</div>
</div>
</div>
Add this <style> section inside your <head> (from index.html):
<style>
.comment-reply { transition: all 0.3s ease; }
.comment-reply:hover { margin-left: 10px; }
/* Animation keyframes */
.animate-fadeIn {
animation: fadeIn 1s ease-out;
}
.animate-slideUp {
animation: slideUp 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.animate-float {
animation: float 3s ease-in-out infinite;
}
.animate-pulse-slow {
animation: pulse-slow 1.5s ease-in-out infinite alternate;
}
@keyframes fadeIn {
0% { opacity: 0; transform: scale(0.8); }
100% { opacity: 1; transform: scale(1); }
}
@keyframes slideUp {
0% {
opacity: 0;
transform: translateY(50px) rotate(5deg);
}
100% {
opacity: 1;
transform: translateY(0) rotate(0);
}
}
@keyframes float {
0% { transform: translateY(0px); }
50% { transform: translateY(-10px); }
100% { transform: translateY(0px); }
}
@keyframes pulse-slow {
0% {
transform: scale(1);
box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4);
}
100% {
transform: scale(1.1);
box-shadow: 0 0 0 15px rgba(99, 102, 241, 0);
}
}
</style>
Apply animations with classes: animate-fadeIn, animate-slideUp, etc.
Beautiful animated button (from index.html):
Tailwind has many color variants:
Go back to PowerShell/Terminal and save your work:
Go back to your browser and refresh your Gitea repository page. You should see your updated files!
Remember: Your teacher can see your beautiful social media platform on Gitea.
Now that you have the basics, make it your own!
Remember to git add, git commit, and git push after each change!
This saves your work and lets your teacher see your progress. Every time you make a change: