Popover
Tooltip
Html Css Js
Animation
Interactive
Composant
Snippet
No Framework
Ui Component
Css Custom
Dark Theme
Collection de popovers interactifs HTML CSS JS sans dépendances : positionnements multiples, styles variés, animations et contenus enrichis.
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8" />
<meta name="copyright" content="AngularForAll" />
<meta name="author" content="AngularForAll" />
<meta name="robots" content="noindex, nofollow" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="Cache-Control" content="public, max-age=604800" />
<title>Snippets Popover HTML CSS JS 2026 05111000 | AngularForAll</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #0f2027 0%, #203a43 50%, #2c5364 100%);
min-height: 100vh;
padding: 30px 20px;
}
.container {
max-width: 1400px;
margin: 0 auto;
}
h1 {
text-align: center;
color: white;
margin-bottom: 15px;
font-size: 2.8rem;
text-shadow: 3px 3px 6px rgba(0,0,0,0.4);
letter-spacing: 2px;
}
.subtitle {
text-align: center;
color: rgba(255,255,255,0.8);
margin-bottom: 50px;
font-size: 1.1rem;
}
.popover-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 30px;
margin-bottom: 40px;
}
/* Styles de base pour tous les popovers */
.popover-wrapper {
position: relative;
display: inline-block;
}
.popover-trigger {
padding: 12px 24px;
border: none;
border-radius: 8px;
font-size: 1rem;
font-weight: 600;
cursor: pointer;
transition: all 0.3s ease;
color: white;
text-transform: uppercase;
letter-spacing: 1px;
box-shadow: 0 4px 15px rgba(0,0,0,0.2);
min-width: 160px;
}
.popover-trigger:hover {
transform: translateY(-2px);
box-shadow: 0 6px 20px rgba(0,0,0,0.3);
}
.popover-content {
position: absolute;
opacity: 0;
visibility: hidden;
transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
pointer-events: none;
z-index: 1000;
background: white;
border-radius: 12px;
box-shadow: 0 10px 40px rgba(0,0,0,0.3);
padding: 20px;
min-width: 250px;
max-width: 350px;
}
.popover-wrapper.active .popover-content {
opacity: 1;
visibility: visible;
pointer-events: all;
}
/* Flèche du popover */
.popover-content::before {
content: '';
position: absolute;
border: 10px solid transparent;
}
/* Style 1 : Popover classique (Bottom) */
.popover-card {
background: white;
border-radius: 20px;
padding: 30px;
box-shadow: 0 15px 40px rgba(0,0,0,0.3);
display: flex;
flex-direction: column;
align-items: center;
gap: 20px;
backdrop-filter: blur(10px);
}
.popover-card h3 {
color: #333;
font-size: 1.3rem;
margin-bottom: 5px;
}
.trigger-blue {
background: linear-gradient(135deg, #2196F3, #1976D2);
}
.popover-bottom {
top: calc(100% + 15px);
left: 50%;
transform: translateX(-50%) scale(0.8);
}
.popover-wrapper.active .popover-bottom {
transform: translateX(-50%) scale(1);
}
.popover-bottom::before {
bottom: 100%;
left: 50%;
transform: translateX(-50%);
border-bottom-color: white;
}
/* Style 2 : Popover avec icône (Top) */
.trigger-green {
background: linear-gradient(135deg, #4CAF50, #388E3C);
}
.popover-top {
bottom: calc(100% + 15px);
left: 50%;
transform: translateX(-50%) scale(0.8);
}
.popover-wrapper.active .popover-top {
transform: translateX(-50%) scale(1);
}
.popover-top::before {
top: 100%;
left: 50%;
transform: translateX(-50%);
border-top-color: white;
}
.popover-header {
display: flex;
align-items: center;
gap: 10px;
margin-bottom: 15px;
padding-bottom: 15px;
border-bottom: 2px solid #f0f0f0;
}
.popover-icon {
width: 40px;
height: 40px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 1.5rem;
background: linear-gradient(135deg, #667eea, #764ba2);
}
/* Style 3 : Popover notification (Right) */
.trigger-orange {
background: linear-gradient(135deg, #FF9800, #F57C00);
}
.popover-right {
left: calc(100% + 15px);
top: 50%;
transform: translateY(-50%) scale(0.8);
}
.popover-wrapper.active .popover-right {
transform: translateY(-50%) scale(1);
}
.popover-right::before {
right: 100%;
top: 50%;
transform: translateY(-50%);
border-right-color: white;
}
.notification-list {
list-style: none;
}
.notification-item {
padding: 12px 0;
border-bottom: 1px solid #e0e0e0;
display: flex;
align-items: center;
gap: 10px;
font-size: 0.9rem;
color: #555;
}
.notification-item:last-child {
border-bottom: none;
}
.notification-badge {
width: 8px;
height: 8px;
border-radius: 50%;
background: #4CAF50;
flex-shrink: 0;
}
.notification-badge.unread {
background: #FF5722;
animation: pulse 2s infinite;
}
@keyframes pulse {
0%, 100% { opacity: 1; }
50% { opacity: 0.5; }
}
/* Style 4 : Popover formulaire (Left) */
.trigger-purple {
background: linear-gradient(135deg, #9C27B0, #7B1FA2);
}
.popover-left {
right: calc(100% + 15px);
top: 50%;
transform: translateY(-50%) scale(0.8);
}
.popover-wrapper.active .popover-left {
transform: translateY(-50%) scale(1);
}
.popover-left::before {
left: 100%;
top: 50%;
transform: translateY(-50%);
border-left-color: white;
}
.popover-form {
display: flex;
flex-direction: column;
gap: 12px;
}
.popover-form input {
padding: 10px;
border: 2px solid #e0e0e0;
border-radius: 6px;
font-size: 0.9rem;
transition: border-color 0.3s;
}
.popover-form input:focus {
outline: none;
border-color: #9C27B0;
}
.popover-form button {
padding: 10px;
background: linear-gradient(135deg, #9C27B0, #7B1FA2);
color: white;
border: none;
border-radius: 6px;
cursor: pointer;
font-weight: 600;
transition: transform 0.2s;
}
.popover-form button:hover {
transform: scale(1.05);
}
/* Style 5 : Popover image (Top-Left) */
.trigger-pink {
background: linear-gradient(135deg, #E91E63, #C2185B);
}
.popover-top-left {
bottom: calc(100% + 15px);
left: 0;
transform: scale(0.8);
transform-origin: bottom left;
}
.popover-wrapper.active .popover-top-left {
transform: scale(1);
}
.popover-top-left::before {
top: 100%;
left: 20px;
border-top-color: white;
}
.popover-image {
width: 100%;
border-radius: 8px;
margin-bottom: 10px;
}
/* Style 6 : Popover menu (Bottom-Right) */
.trigger-teal {
background: linear-gradient(135deg, #009688, #00796B);
}
.popover-bottom-right {
top: calc(100% + 15px);
right: 0;
transform: scale(0.8);
transform-origin: top right;
}
.popover-wrapper.active .popover-bottom-right {
transform: scale(1);
}
.popover-bottom-right::before {
bottom: 100%;
right: 20px;
border-bottom-color: white;
}
.popover-menu {
list-style: none;
}
.popover-menu li {
padding: 12px 15px;
cursor: pointer;
transition: background 0.2s;
border-radius: 6px;
display: flex;
align-items: center;
gap: 10px;
color: #333;
font-size: 0.95rem;
}
.popover-menu li:hover {
background: #f5f5f5;
}
.popover-menu li:not(:last-child) {
border-bottom: 1px solid #f0f0f0;
}
/* Style 7 : Popover avec onglets (Bottom-Left) */
.trigger-red {
background: linear-gradient(135deg, #f44336, #D32F2F);
}
.popover-bottom-left {
top: calc(100% + 15px);
left: 0;
transform: scale(0.8);
transform-origin: top left;
}
.popover-wrapper.active .popover-bottom-left {
transform: scale(1);
}
.popover-bottom-left::before {
bottom: 100%;
left: 20px;
border-bottom-color: white;
}
.tabs {
display: flex;
gap: 5px;
margin-bottom: 15px;
border-bottom: 2px solid #e0e0e0;
padding-bottom: 10px;
}
.tab {
padding: 8px 15px;
cursor: pointer;
border-radius: 6px 6px 0 0;
font-size: 0.9rem;
font-weight: 600;
color: #666;
transition: all 0.2s;
}
.tab.active {
background: #f44336;
color: white;
}
.tab-content {
font-size: 0.9rem;
color: #555;
line-height: 1.6;
}
/* Style 8 : Popover glassmorphisme */
.trigger-glass {
background: rgba(255,255,255,0.2);
backdrop-filter: blur(10px);
border: 1px solid rgba(255,255,255,0.3);
color: white;
}
.popover-glass {
background: rgba(255,255,255,0.15);
backdrop-filter: blur(20px);
border: 1px solid rgba(255,255,255,0.2);
top: calc(100% + 15px);
left: 50%;
transform: translateX(-50%) scale(0.8);
color: white;
}
.popover-wrapper.active .popover-glass {
transform: translateX(-50%) scale(1);
}
.popover-glass::before {
bottom: 100%;
left: 50%;
transform: translateX(-50%);
border-bottom-color: rgba(255,255,255,0.15);
}
.glass-content {
color: white;
}
.glass-content h4 {
margin-bottom: 10px;
font-size: 1.2rem;
}
.glass-content p {
font-size: 0.9rem;
opacity: 0.9;
line-height: 1.6;
}
/* Style 9 : Popover large avec grille */
.trigger-indigo {
background: linear-gradient(135deg, #3F51B5, #303F9F);
}
.popover-grid-layout {
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 10px;
margin-top: 10px;
}
.grid-item {
background: #f5f5f5;
padding: 15px;
border-radius: 8px;
text-align: center;
cursor: pointer;
transition: all 0.2s;
}
.grid-item:hover {
background: #e0e0e0;
transform: scale(1.05);
}
.grid-item span {
font-size: 1.5rem;
display: block;
margin-bottom: 5px;
}
/* Overlay pour fermer les popovers */
.popover-overlay {
position: fixed;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: rgba(0,0,0,0.3);
opacity: 0;
visibility: hidden;
transition: all 0.3s;
z-index: 999;
}
.popover-overlay.active {
opacity: 1;
visibility: visible;
}
/* Section sombre */
.dark-section {
background: rgba(0,0,0,0.3);
backdrop-filter: blur(10px);
border-radius: 20px;
padding: 40px;
margin-top: 30px;
}
.dark-section h2 {
color: white;
text-align: center;
margin-bottom: 30px;
}
/* Responsive */
@media (max-width: 768px) {
.popover-grid {
grid-template-columns: 1fr;
}
h1 {
font-size: 2rem;
}
.popover-content {
max-width: 280px;
min-width: 200px;
}
}
</style>
</head>
<body>
<div class="popover-overlay" id="overlay"></div>
<div class="container">
<h1>💬 Popovers Multistyles</h1>
<p class="subtitle">Cliquez sur les boutons pour afficher les popovers • 9 styles différents</p>
<div class="popover-grid">
<!-- Style 1 : Popover basique (Bottom) -->
<div class="popover-card">
<h3>📋 Popover Classique</h3>
<div class="popover-wrapper" id="popover1">
<button class="popover-trigger trigger-blue" onclick="openMyPopover('popover1')">
💡 Info Bottom
</button>
<div class="popover-content popover-bottom">
<div class="popover-header">
<span style="font-size: 1.5rem;">💡</span>
<strong>Information</strong>
</div>
<p style="color: #666; line-height: 1.6; font-size: 0.9rem;">
Ceci est un popover classique qui apparaît en bas du bouton. Il contient des informations utiles.
</p>
<button style="margin-top: 10px; padding: 8px 15px; background: #2196F3; color: white; border: none; border-radius: 5px; cursor: pointer; width: 100%;" onclick="event.stopPropagation(); alert('Action confirmée !')">
Action
</button>
</div>
</div>
</div>
<!-- Style 2 : Popover Top avec notifications -->
<div class="popover-card">
<h3>🔔 Notifications (Top)</h3>
<div class="popover-wrapper" id="popover2">
<button class="popover-trigger trigger-green" onclick="openMyPopover('popover2')">
🔔 Notifications Top
</button>
<div class="popover-content popover-top">
<div class="popover-header">
<span style="font-size: 1.5rem;">🔔</span>
<strong>Notifications</strong>
<span style="margin-left: auto; background: #FF5722; color: white; padding: 2px 8px; border-radius: 10px; font-size: 0.8rem;">3</span>
</div>
<ul class="notification-list">
<li class="notification-item">
<span class="notification-badge unread"></span>
Nouveau message reçu
</li>
<li class="notification-item">
<span class="notification-badge unread"></span>
Mise à jour disponible
</li>
<li class="notification-item">
<span class="notification-badge"></span>
Tâche terminée
</li>
</ul>
</div>
</div>
</div>
<!-- Style 3 : Popover Right -->
<div class="popover-card">
<h3>📱 Quick View (Right)</h3>
<div class="popover-wrapper" id="popover3">
<button class="popover-trigger trigger-orange" onclick="openMyPopover('popover3')">
👤 Profil Right
</button>
<div class="popover-content popover-right">
<div style="text-align: center;">
<div style="width: 60px; height: 60px; background: linear-gradient(135deg, #FF9800, #F57C00); border-radius: 50%; margin: 0 auto 10px; display: flex; align-items: center; justify-content: center; font-size: 2rem;">👤</div>
<strong style="display: block;">John Doe</strong>
<span style="color: #666; font-size: 0.85rem;">Développeur Web</span>
<div style="margin-top: 15px; display: flex; gap: 8px; justify-content: center;">
<button style="padding: 8px 15px; background: #FF9800; color: white; border: none; border-radius: 5px; cursor: pointer; font-size: 0.85rem;">Profil</button>
<button style="padding: 8px 15px; background: #f5f5f5; color: #333; border: none; border-radius: 5px; cursor: pointer; font-size: 0.85rem;">Message</button>
</div>
</div>
</div>
</div>
</div>
<!-- Style 4 : Popover Left avec formulaire -->
<div class="popover-card">
<h3>📝 Connexion (Left)</h3>
<div class="popover-wrapper" id="popover4">
<button class="popover-trigger trigger-purple" onclick="openMyPopover('popover4')">
🔐 Login Left
</button>
<div class="popover-content popover-left">
<h4 style="margin-bottom: 15px; color: #333;">Connexion rapide</h4>
<form class="popover-form" onsubmit="event.preventDefault(); alert('Formulaire soumis !');">
<input type="email" placeholder="Email" required>
<input type="password" placeholder="Mot de passe" required>
<button type="submit">Se connecter</button>
</form>
</div>
</div>
</div>
<!-- Style 5 : Popover Top-Left avec image -->
<div class="popover-card">
<h3>🖼️ Aperçu (Top-Left)</h3>
<div class="popover-wrapper" id="popover5">
<button class="popover-trigger trigger-pink" onclick="openMyPopover('popover5')">
🖼️ Image Top-Left
</button>
<div class="popover-content popover-top-left">
<div style="width: 100%; height: 150px; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); border-radius: 8px; margin-bottom: 10px; display: flex; align-items: center; justify-content: center; font-size: 3rem;">🖼️</div>
<h4 style="color: #333;">Aperçu de l'image</h4>
<p style="color: #666; font-size: 0.85rem;">Cliquez pour voir en grand</p>
</div>
</div>
</div>
<!-- Style 6 : Popover Bottom-Right menu -->
<div class="popover-card">
<h3>📂 Menu (Bottom-Right)</h3>
<div class="popover-wrapper" id="popover6">
<button class="popover-trigger trigger-teal" onclick="openMyPopover('popover6')">
⚙️ Menu BR
</button>
<div class="popover-content popover-bottom-right">
<ul class="popover-menu">
<li>📄 Nouveau document</li>
<li>📁 Ouvrir un fichier</li>
<li>💾 Enregistrer</li>
<li>⚙️ Paramètres</li>
<li>🚪 Déconnexion</li>
</ul>
</div>
</div>
</div>
<!-- Style 7 : Popover Bottom-Left avec onglets -->
<div class="popover-card">
<h3>📑 Onglets (Bottom-Left)</h3>
<div class="popover-wrapper" id="popover7">
<button class="popover-trigger trigger-red" onclick="openMyPopover('popover7')">
📑 Tabs BL
</button>
<div class="popover-content popover-bottom-left">
<div class="tabs">
<div class="tab active" onclick="switchTab(event, 'tab1')">Info</div>
<div class="tab" onclick="switchTab(event, 'tab2')">Détails</div>
</div>
<div class="tab-content" id="tab1">
<strong>Information principale</strong>
<p>Contenu de l'onglet 1 avec des détails importants.</p>
</div>
<div class="tab-content" id="tab2" style="display: none;">
<strong>Détails supplémentaires</strong>
<p>Plus d'informations dans l'onglet 2.</p>
</div>
</div>
</div>
</div>
<!-- Style 8 : Popover Glassmorphisme -->
<div class="popover-card" style="background: rgba(255,255,255,0.1); backdrop-filter: blur(10px);">
<h3 style="color: white;">🔮 Glassmorphisme</h3>
<div class="popover-wrapper" id="popover8">
<button class="popover-trigger trigger-glass" onclick="openMyPopover('popover8')">
🔮 Glass Effect
</button>
<div class="popover-content popover-glass">
<div class="glass-content">
<h4>Effet verre</h4>
<p>Un popover avec effet glassmorphisme moderne et élégant.</p>
</div>
</div>
</div>
</div>
<!-- Style 9 : Popover avec grille -->
<div class="popover-card">
<h3>🎯 Grille rapide</h3>
<div class="popover-wrapper" id="popover9">
<button class="popover-trigger trigger-indigo" onclick="openMyPopover('popover9')">
🎯 Quick Actions
</button>
<div class="popover-content popover-bottom">
<h4 style="margin-bottom: 15px; color: #333;">Actions rapides</h4>
<div class="popover-grid-layout">
<div class="grid-item" onclick="event.stopPropagation(); alert('Nouveau fichier')">
<span>📄</span> Nouveau
</div>
<div class="grid-item" onclick="event.stopPropagation(); alert('Rechercher')">
<span>🔍</span> Rechercher
</div>
<div class="grid-item" onclick="event.stopPropagation(); alert('Partager')">
<span>📤</span> Partager
</div>
<div class="grid-item" onclick="event.stopPropagation(); alert('Supprimer')">
<span>🗑️</span> Supprimer
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Section démonstration interactive -->
<div class="dark-section">
<h2>🎮 Démonstration interactive</h2>
<div style="display: flex; justify-content: center; gap: 20px; flex-wrap: wrap;">
<div class="popover-wrapper" id="demoPopover1">
<button class="popover-trigger" style="background: linear-gradient(135deg, #FF6B6B, #FF8E53);" onclick="openMyPopover('demoPopover1')">
🎯 Haut
</button>
<div class="popover-content popover-top" style="background: linear-gradient(135deg, #FF6B6B, #FF8E53); color: white;">
<div class="popover-header" style="border-bottom-color: rgba(255,255,255,0.3);">
<strong style="color: white;">Popover stylisé</strong>
</div>
<p style="color: rgba(255,255,255,0.9);">Avec dégradé de couleurs !</p>
</div>
</div>
<div class="popover-wrapper" id="demoPopover2">
<button class="popover-trigger" style="background: linear-gradient(135deg, #a8edea, #fed6e3); color: #333;" onclick="openMyPopover('demoPopover2')">
🎯 Bas
</button>
<div class="popover-content popover-bottom" style="background: linear-gradient(135deg, #a8edea, #fed6e3);">
<p style="color: #333;">Style pastel doux</p>
</div>
</div>
</div>
</div>
</div>
<script>
let activePopover = null;
// Utiliser un nom qui n'entre PAS en conflit avec l'API Popover native
function openMyPopover(popoverId) {
const wrapper = document.getElementById(popoverId);
const overlay = document.getElementById('overlay');
if (activePopover === popoverId) {
closeMyPopover();
} else {
if (activePopover) {
const previousWrapper = document.getElementById(activePopover);
if (previousWrapper) {
previousWrapper.classList.remove('active');
}
}
wrapper.classList.add('active');
overlay.classList.add('active');
activePopover = popoverId;
}
}
function closeMyPopover() {
if (activePopover) {
const wrapper = document.getElementById(activePopover);
if (wrapper) {
wrapper.classList.remove('active');
}
document.getElementById('overlay').classList.remove('active');
activePopover = null;
}
}
document.getElementById('overlay').addEventListener('click', closeMyPopover);
document.addEventListener('keydown', function(e) {
if (e.key === 'Escape') {
closeMyPopover();
}
});
document.querySelectorAll('.popover-content').forEach(content => {
content.addEventListener('click', function(e) {
e.stopPropagation();
});
});
document.addEventListener('click', function(e) {
if (activePopover && !e.target.closest('.popover-wrapper')) {
closeMyPopover();
}
});
function switchTab(event, tabId) {
const popover = event.target.closest('.popover-content');
const tabs = popover.querySelectorAll('.tab');
const contents = popover.querySelectorAll('.tab-content');
tabs.forEach(tab => tab.classList.remove('active'));
contents.forEach(content => content.style.display = 'none');
event.target.classList.add('active');
document.getElementById(tabId).style.display = 'block';
}
document.querySelectorAll('.popover-trigger').forEach(trigger => {
trigger.addEventListener('touchstart', function(e) {
e.preventDefault();
this.click();
});
});
window.addEventListener('scroll', function() {
if (activePopover) {
const wrapper = document.getElementById(activePopover);
if (wrapper) {
const rect = wrapper.getBoundingClientRect();
if (rect.bottom < 0 || rect.top > window.innerHeight) {
closeMyPopover();
}
}
}
});
</script>
</body>
</html>
Télécharger le fichier source