Tako12's picture
Create an HTML + CSS responsive template for an articles listing page, based on this layout:
cb97292 verified
Raw History Blame Contribute Delete
14.7 kB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Moodescape | Articles</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap" rel="stylesheet">
<script src="https://cdn.tailwindcss.com"></script>
<script src="https://unpkg.com/feather-icons"></script>
<script src="https://cdn.jsdelivr.net/npm/feather-icons/dist/feather.min.js"></script>
<style>
:root {
--primary-light: #f8f4e9;
--secondary-light: #ffffff;
--text-light: #333333;
--primary-dark: #1a1a1a;
--secondary-dark: #2d2d2d;
--text-dark: #f0f0f0;
--accent: #6d28d9;
}
body {
font-family: 'Inter', sans-serif;
transition: background-color 0.3s ease, color 0.3s ease;
}
.light-theme {
background-color: var(--primary-light);
color: var(--text-light);
}
.dark-theme {
background-color: var(--primary-dark);
color: var(--text-dark);
}
.card-light {
background-color: var(--secondary-light);
}
.card-dark {
background-color: var(--secondary-dark);
}
.hero-gradient {
background: linear-gradient(135deg, rgba(109,40,217,0.8) 0%, rgba(124,58,237,0.6) 100%);
}
.article-card {
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.article-card:hover {
transform: translateY(-5px);
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
}
.article-card:hover .article-title {
color: var(--accent);
}
.article-image {
transition: transform 0.3s ease;
}
.article-card:hover .article-image {
transform: scale(1.03);
}
.hamburger {
display: none;
}
@media (max-width: 768px) {
.nav-links {
display: none;
}
.hamburger {
display: block;
}
.mobile-menu {
display: none;
}
.mobile-menu.active {
display: block;
}
}
</style>
</head>
<body class="light-theme">
<!-- Header/Navigation -->
<header class="sticky top-0 z-50 shadow-sm">
<nav class="px-4 py-3 md:px-8 md:py-4 flex justify-between items-center card-light dark:card-dark transition-colors duration-300">
<div class="text-xl font-bold">Logo</div>
<div class="hidden md:flex space-x-6 nav-links">
<a href="#" class="font-medium hover:text-purple-600 transition-colors active">Moodescape</a>
<a href="#" class="font-medium hover:text-purple-600 transition-colors">Books</a>
<a href="#" class="font-medium hover:text-purple-600 transition-colors">Films/TVseries</a>
<a href="#" class="font-medium hover:text-purple-600 transition-colors">Anime</a>
<a href="#" class="font-medium hover:text-purple-600 transition-colors">Games</a>
</div>
<div class="flex items-center space-x-4">
<button id="theme-toggle" class="p-2 rounded-full hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors">
<i data-feather="sun" class="hidden dark:block"></i>
<i data-feather="moon" class="dark:hidden"></i>
</button>
<button id="hamburger" class="hamburger p-2 rounded-full hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors md:hidden">
<i data-feather="menu"></i>
</button>
</div>
</nav>
<!-- Mobile Menu -->
<div id="mobile-menu" class="mobile-menu card-light dark:card-dark px-4 py-2 shadow-md">
<a href="#" class="block py-2 px-2 font-medium hover:text-purple-600 transition-colors active">Moodescape</a>
<a href="#" class="block py-2 px-2 font-medium hover:text-purple-600 transition-colors">Books</a>
<a href="#" class="block py-2 px-2 font-medium hover:text-purple-600 transition-colors">Films/TVseries</a>
<a href="#" class="block py-2 px-2 font-medium hover:text-purple-600 transition-colors">Anime</a>
<a href="#" class="block py-2 px-2 font-medium hover:text-purple-600 transition-colors">Games</a>
</div>
</header>
<!-- Hero Banner -->
<section class="hero-gradient text-white py-16 md:py-24 mb-8">
<div class="container mx-auto px-4 text-center">
<h1 class="text-3xl md:text-5xl font-bold mb-4">Welcome to Moodescape</h1>
<p class="text-xl md:text-2xl opacity-90">Discover your next favorite story</p>
</div>
</section>
<!-- Search Section -->
<section class="container mx-auto px-4 mb-12">
<div class="flex flex-col md:flex-row gap-4 items-center">
<div class="relative flex-grow">
<input type="text" placeholder="Search..." class="w-full px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-purple-500 transition-all">
<i data-feather="search" class="absolute right-3 top-3.5 text-gray-400"></i>
</div>
<select class="px-4 py-3 rounded-lg border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-purple-500 transition-all">
<option value="">All Categories</option>
<option value="books">Books</option>
<option value="films">Films/TVseries</option>
<option value="anime">Anime</option>
<option value="games">Games</option>
</select>
<button class="px-6 py-3 bg-purple-600 text-white rounded-lg hover:bg-purple-700 transition-colors flex items-center gap-2">
<i data-feather="search" class="w-4 h-4"></i>
<span>Search</span>
</button>
</div>
</section>
<!-- Articles Grid -->
<section class="container mx-auto px-4 mb-16">
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8">
<!-- Article Card 1 -->
<div class="article-card rounded-xl overflow-hidden shadow-md card-light dark:card-dark">
<div class="overflow-hidden">
<img src="https://source.unsplash.com/random/600x400/?book" alt="Article image" class="w-full h-48 object-cover article-image">
</div>
<div class="p-6">
<h3 class="article-title text-xl font-semibold mb-3 transition-colors">The Hidden Gems of Modern Literature</h3>
<a href="#" class="text-purple-600 font-medium flex items-center gap-1 hover:gap-2 transition-all">
Read more <i data-feather="arrow-right" class="w-4 h-4"></i>
</a>
</div>
</div>
<!-- Article Card 2 -->
<div class="article-card rounded-xl overflow-hidden shadow-md card-light dark:card-dark">
<div class="overflow-hidden">
<img src="https://source.unsplash.com/random/600x400/?movie" alt="Article image" class="w-full h-48 object-cover article-image">
</div>
<div class="p-6">
<h3 class="article-title text-xl font-semibold mb-3 transition-colors">Must-Watch Indie Films of 2024</h3>
<a href="#" class="text-purple-600 font-medium flex items-center gap-1 hover:gap-2 transition-all">
Read more <i data-feather="arrow-right" class="w-4 h-4"></i>
</a>
</div>
</div>
<!-- Article Card 3 -->
<div class="article-card rounded-xl overflow-hidden shadow-md card-light dark:card-dark">
<div class="overflow-hidden">
<img src="https://source.unsplash.com/random/600x400/?anime" alt="Article image" class="w-full h-48 object-cover article-image">
</div>
<div class="p-6">
<h3 class="article-title text-xl font-semibold mb-3 transition-colors">Anime That Will Make You Think</h3>
<a href="#" class="text-purple-600 font-medium flex items-center gap-1 hover:gap-2 transition-all">
Read more <i data-feather="arrow-right" class="w-4 h-4"></i>
</a>
</div>
</div>
<!-- Article Card 4 -->
<div class="article-card rounded-xl overflow-hidden shadow-md card-light dark:card-dark">
<div class="overflow-hidden">
<img src="https://source.unsplash.com/random/600x400/?game" alt="Article image" class="w-full h-48 object-cover article-image">
</div>
<div class="p-6">
<h3 class="article-title text-xl font-semibold mb-3 transition-colors">Narrative-Driven Games You Shouldn't Miss</h3>
<a href="#" class="text-purple-600 font-medium flex items-center gap-1 hover:gap-2 transition-all">
Read more <i data-feather="arrow-right" class="w-4 h-4"></i>
</a>
</div>
</div>
<!-- Article Card 5 -->
<div class="article-card rounded-xl overflow-hidden shadow-md card-light dark:card-dark">
<div class="overflow-hidden">
<img src="https://source.unsplash.com/random/600x400/?reading" alt="Article image" class="w-full h-48 object-cover article-image">
</div>
<div class="p-6">
<h3 class="article-title text-xl font-semibold mb-3 transition-colors">How to Build a Reading Habit in 30 Days</h3>
<a href="#" class="text-purple-600 font-medium flex items-center gap-1 hover:gap-2 transition-all">
Read more <i data-feather="arrow-right" class="w-4 h-4"></i>
</a>
</div>
</div>
<!-- Article Card 6 -->
<div class="article-card rounded-xl overflow-hidden shadow-md card-light dark:card-dark">
<div class="overflow-hidden">
<img src="https://source.unsplash.com/random/600x400/?cinema" alt="Article image" class="w-full h-48 object-cover article-image">
</div>
<div class="p-6">
<h3 class="article-title text-xl font-semibold mb-3 transition-colors">The Evolution of Cinematography Techniques</h3>
<a href="#" class="text-purple-600 font-medium flex items-center gap-1 hover:gap-2 transition-all">
Read more <i data-feather="arrow-right" class="w-4 h-4"></i>
</a>
</div>
</div>
</div>
</section>
<!-- Pagination -->
<section class="container mx-auto px-4 mb-16">
<div class="flex justify-center items-center gap-2">
<button class="px-4 py-2 rounded-lg bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 transition-colors">
<i data-feather="chevron-left" class="w-4 h-4"></i>
</button>
<button class="px-4 py-2 rounded-lg bg-purple-600 text-white">1</button>
<button class="px-4 py-2 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors">2</button>
<button class="px-4 py-2 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors">3</button>
<button class="px-4 py-2 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors">4</button>
<span class="px-2">...</span>
<button class="px-4 py-2 rounded-lg hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors">12</button>
<button class="px-4 py-2 rounded-lg bg-gray-200 dark:bg-gray-700 hover:bg-gray-300 dark:hover:bg-gray-600 transition-colors">
<i data-feather="chevron-right" class="w-4 h-4"></i>
</button>
</div>
</section>
<!-- Footer -->
<footer class="py-6 text-center border-t border-gray-200 dark:border-gray-700">
<div class="container mx-auto px-4">
<p class="text-gray-600 dark:text-gray-400">© 2025 Moodescape. All rights reserved.</p>
</div>
</footer>
<script>
// Theme toggle functionality
const themeToggle = document.getElementById('theme-toggle');
const html = document.documentElement;
// Check for saved user preference or use system preference
const savedTheme = localStorage.getItem('theme') ||
(window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light');
// Apply the saved theme
html.classList.add(savedTheme === 'dark' ? 'dark-theme' : 'light-theme');
themeToggle.addEventListener('click', () => {
html.classList.toggle('dark-theme');
html.classList.toggle('light-theme');
// Save user preference
const currentTheme = html.classList.contains('dark-theme') ? 'dark' : 'light';
localStorage.setItem('theme', currentTheme);
});
// Mobile menu toggle
const hamburger = document.getElementById('hamburger');
const mobileMenu = document.getElementById('mobile-menu');
hamburger.addEventListener('click', () => {
mobileMenu.classList.toggle('active');
});
// Initialize feather icons
document.addEventListener('DOMContentLoaded', function() {
feather.replace();
});
</script>
</body>
</html>