Voici une page d'accueil avec le style Netflix, incluant des colonnes de films défilables, un panneau latéral et le design caractéristique.
html Copy code
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Netflix Clone</title>
<style>
:root {
--netflix-red: #e50914;
--netflix-black: #141414;
--netflix-gray: #303030;
--netflix-light-gray: #757575;
--netflix-white: #ffffff;
}
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}
body {
background-color: var(--netflix-black);
color: var(--netflix-white);
line-height: 1.5;
}
.header {
display: flex;
justify-content: space-between;
align-items: center;
padding: 20px 4%;
position: fixed;
width: 100%;
z-index: 100;
background-color: rgba(20, 20, 20, 0.9);
}
.logo {
width: 120px;
cursor: pointer;
}
.nav-links {
display: flex;
gap: 20px;
}
.nav-link {
color: var(--netflix-white);
text-decoration: none;
font-size: 14px;
cursor: pointer;
}
.nav-link:hover {
color: var(--netflix-light-gray);
}
.profile-icon {
width: 32px;
height: 32px;
border-radius: 4px;
cursor: pointer;
background-color: var(--netflix-gray);
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
}
.main-content {
padding-top: 80px;
}
.hero {
position: relative;
height: 60vh;
background: linear-gradient(to bottom, rgba(20, 20, 20, 0.7), rgba(20, 20, 20, 1)),
url('https://via.placeholder.com/1920x1080/333333/ffffff?text=Featured+Movie');
background-size: cover;
background-position: center;
display: flex;
flex-direction: column;
justify-content: center;
padding-left: 4%;
}
.hero-content {
max-width: 500px;
}
.hero-title {
font-size: 3.5rem;
font-weight: 700;
margin-bottom: 10px;
}
.hero-description {
margin-bottom: 20px;
font-size: 1.1rem;
}
.hero-buttons {
display: flex;
gap: 10px;
}
.btn {
padding: 10px 20px;
border-radius: 4px;
font-weight: bold;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
gap: 8px;
}
.btn-primary {
background-color: var(--netflix-white);
color: var(--netflix-black);
}
.btn-secondary {
background-color: rgba(109, 109, 110, 0.7);
color: var(--netflix-white);
}
.movie-row {
margin-bottom: 40px;
padding: 0 4%;
}
.row-title {
font-size: 1.5rem;
margin-bottom: 15px;
}
.row-container {
display: flex;
overflow-x: auto;
gap: 10px;
scroll-behavior: smooth;
padding-bottom: 20px;
position: relative;
}
.row-container::-webkit-scrollbar {
display: none;
}
.movie-card {
min-width: 200px;
height: 110px;
background-color: var(--netflix-gray);
border-radius: 4px;
cursor: pointer;
transition: transform 0.2s;
position: relative;
}
.movie-card:hover {
transform: scale(1.05);
}
.movie-card img {
width: 100%;
height: 100%;
object-fit: cover;
border-radius: 4px;
}
.sidebar {
position: fixed;
top: 0;
right: -300px;
width: 300px;
height: 100vh;
background-color: var(--netflix-black);
border-left: 1px solid var(--netflix-gray);
transition: right 0.3s ease;
z-index: 200;
padding: 20px;
box-shadow: -5px 0 15px rgba(0, 0, 0, 0.5);
}
.sidebar.active {
right: 0;
}
.sidebar-header {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 30px;
}
.close-btn {
background: none;
border: none;
color: var(--netflix-white);
font-size: 24px;
cursor: pointer;
}
.sidebar-content {
display: flex;
flex-direction: column;
gap: 20px;
}
.profile-section {
display: flex;
align-items: center;
gap: 15px;
margin-bottom: 20px;
}
.profile-picture {
width: 60px;
height: 60px;
border-radius: 4px;
background-color: var(--netflix-gray);
display: flex;
align-items: center;
justify-content: center;
font-weight: bold;
font-size: 24px;
}
.profile-info h3 {
margin-bottom: 5px;
}
.profile-info p {
color: var(--netflix-light-gray);
font-size: 14px;
}
.sidebar-link {
color: var(--netflix-white);
text-decoration: none;
font-size: 16px;
padding: 10px 0;
display: block;
}
.sidebar-link:hover {
color: var(--netflix-light-gray);
text-decoration: underline;
}
.logout-btn {
margin-top: 20px;
padding: 10px;
background-color: var(--netflix-gray);
border: none;
color: var(--netflix-white);
border-radius: 4px;
cursor: pointer;
font-weight: bold;
}
.overlay {
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(0, 0, 0, 0.5);
z-index: 150;
display: none;
}
.overlay.active {
display: block;
}
</style>
</head>
<body>
<div class="overlay" id="overlay"></div>
<div class="sidebar" id="sidebar">
<div class="sidebar-header">
<h2>Mon compte</h2>
<button class="close-btn" id="closeSidebar">×</button>
</div>
<div class="sidebar-content">
<div class="profile-section">
<div class="profile-picture">A</div>
<div class="profile-info">
<h3>Alexandre</h3>
<p>alexandre@example.com</p>
</div>
</div>
<a href="#" class="sidebar-link">Mon profil</a>
<a href="#" class="sidebar-link">Paramètres du compte</a>
<a href="#" class="sidebar-link">Historique</a>
<a href="#" class="sidebar-link">Mes listes</a>
<a href="#" class="sidebar-link">Aide</a>
<button class="logout-btn">Se déconnecter</button>
</div>
</div>
<header class="header">
<img src="https://via.placeholder.com/120x40/ffffff/000000?text=NETFLIX" alt="Netflix Logo" class="logo">
<div class="nav-links">
<a href="#" class="nav-link">Accueil</a>
<a href="#" class="nav-link">Séries</a>
<a href="#" class="nav-link">Films</a>
<a href="#" class="nav-link">Nouveautés</a>
<a href="#" class="nav-link">Ma liste</a>
</div>
<div class="profile-icon" id="profileIcon">A</div>
</header>
<main class="main-content">
<section class="hero">
<div class="hero-content">
<h1 class="hero-title">Stranger Things</h1>
<p class="hero-description">Quand un jeune garçon disparaît, sa mère, un chef de police et ses amis doivent affronter des forces surnaturelles et un mystère gouvernemental.</p>
<div class="hero-buttons">
<button class="btn btn-primary">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M4 2.69127C4 1.93067 4.81547 1.44851 5.48195 1.81805L21.4033 12.0007C22.0698 12.3702 22.0698 13.6298 21.4033 13.9993L5.48195 24.1815C4.81547 24.551 4 24.0689 4 23.3083V2.69127Z" fill="currentColor"/>
</svg>
Lecture
</button>
<button class="btn btn-secondary">
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M12 2C6.48 2 2 6.48 2 12C2 17.52 6.48 22 12 22C17.52 22 22 17.52 22 12C22 6.48 17.52 2 12 2ZM12 20C7.59 20 4 16.41 4 12C4 7.59 7.59 4 12 4C16.41 4 20 7.59 20 12C20 16.41 16.41 20 12 20Z" fill="currentColor"/>
<path d="M12 6C8.69 6 6 8.69 6 12C6 15.31 8.69 18 12 18C15.31 18 18 15.31 18 12C18 8.69 15.31 6 12 6ZM12 16C9.79 16 8 14.21 8 12C8 9.79 9.79 8 12 8C14.21 8 16 9.79 16 12C16 14.21 14.21 16 12 16Z" fill="currentColor"/>
</svg>
Plus d'infos
</button>
</div>
</div>
</section>
<section class="movie-row">
<h2 class="row-title">Tendances actuelles</h2>
<div class="row-container" id="row1">
<!-- Movies will be added by JavaScript -->
</div>
</section>
<section class="movie-row">
<h2 class="row-title">Films populaires</h2>
<div class="row-container" id="row2">
<!-- Movies will be added by JavaScript -->
</div>
</section>
<section class="movie-row">
<h2 class="row-title">Recommandés pour vous</h2>
<div class="row-container" id="row3">
<!-- Movies will be added by JavaScript -->
</div>
</section>
</main>
<script>
// Generate movie cards
function generateMovieCards(containerId, count) {
const container = document.getElementById(containerId);
for (let i = 0; i < count; i++) {
const movieCard = document.createElement('div');
movieCard.className = 'movie-card';
movieCard.innerHTML = `<img src="https://via.placeholder.com/200x110/333333/ffffff?text=Movie+${i+1}" alt="Movie ${i+1}">`;
container.appendChild(movieCard);
}
}
// Generate movie cards for each row
generateMovieCards('row1', 20);
generateMovieCards('row2', 20);
generateMovieCards('row3', 20);
// Sidebar functionality
const profileIcon = document.getElementById('profileIcon');
const sidebar = document.getElementById('sidebar');
const overlay = document.getElementById('overlay');
const closeSidebar = document.getElementById('closeSidebar');
profileIcon.addEventListener('click', () => {
sidebar.classList.add('active');
overlay.classList.add('active');
});
closeSidebar.addEventListener('click', () => {
sidebar.classList.remove('active');
overlay.classList.remove('active');
});
overlay.addEventListener('click', () => {
sidebar.classList.remove('active');
overlay.classList.remove('active');
});
// Infinite scroll for movie rows
const rowContainers = document.querySelectorAll('.row-container');
rowContainers.forEach(container => {
container.addEventListener('scroll', () => {
const scrollLeft = container.scrollLeft;
const scrollWidth = container.scrollWidth;
const clientWidth = container.clientWidth;
if (scrollLeft + clientWidth >= scrollWidth - 10) {
// Clone first few items and append to end
const firstItems = Array.from(container.children).slice(0, 5);
firstItems.forEach(item => {
const clone = item.cloneNode(true);
container.appendChild(clone);
});
} else if (scrollLeft <= 10) {
// Clone last few items and prepend to beginning
const lastItems = Array.from(container.children).slice(-5);
lastItems.reverse().forEach(item => {
const clone = item.cloneNode(true);
container.insertBefore(clone, container.firstChild);
});
// Reset scroll position
container.scrollLeft = container.scrollWidth / 3;
}
});
});
</script>
</body>
</html>
Le code est prêt à être utilisé et peut être facilement personnalisé avec vos propres images et contenu.