Comment mettre un diaporama en image de fond avec HTML et CSS ?
Résolu
muramasakatana
Messages postés
36
Date d'inscription
Statut
Membre
Dernière intervention
-
muramasakatana Messages postés 36 Date d'inscription Statut Membre Dernière intervention -
muramasakatana Messages postés 36 Date d'inscription Statut Membre Dernière intervention -
Bonjour, Bonsoir. Je cherche a mettre un diaporama image de fond et la barre horizontal du menu par dessus en mi-transparant. Si il y a un moyen juste avec l'HTML et le CSS j'aimerais bien le connaitre et si javascript oblige, j'aimerais savoir aussi... Merci.
je sais créer une animation donc pas besoin du code entier, juste : d'ou commencer ?
je sais créer une animation donc pas besoin du code entier, juste : d'ou commencer ?
A voir également:
- Html diaporama
- Editeur html - Télécharger - HTML
- Faire un diaporama photo avec musique windows 10 - Guide
- Mettre plusieurs musique sur diaporama powerpoint ✓ - Forum Powerpoint
- Br html ✓ - Forum Webmastering
- Sélectionnez une extension correspondant à un fichier de présentation (diaporama). ✓ - Forum Powerpoint
1 réponse
Salut
en voila un tout en css!
tu met un reset css (meyer par exemple ) c est plus simple pour les marges et la liste mais n oublie pas de mettre du css pour styler tes balises ensuite ! , puis tu adapte la fin du css .diaporama li span a ton anim
je te conseille de mettre des images d environs 1024px/860px optimisees !
ensuite tu met ton menu dans la div menu
j ai mis une animation dans le code pour ceux qui viendraient sur ce post et ne sauraient pas le faire !
a+
en voila un tout en css!
tu met un reset css (meyer par exemple ) c est plus simple pour les marges et la liste mais n oublie pas de mettre du css pour styler tes balises ensuite ! , puis tu adapte la fin du css .diaporama li span a ton anim
je te conseille de mettre des images d environs 1024px/860px optimisees !
ensuite tu met ton menu dans la div menu
j ai mis une animation dans le code pour ceux qui viendraient sur ce post et ne sauraient pas le faire !
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <title> Fullscreen Background Image diaporama CSS3 </title> <style type="text/css"> /* http://meyerweb.com/eric/tools/css/reset/ v2.0 | 20110126 License: none (public domain) */ html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font-size:100%;font:inherit;vertical-align:baseline} article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block} body{line-height:1} ol,ul{list-style:none} blockquote,q{quotes:none} blockquote:before,blockquote:after,q:before,q:after{content:'';content:none} table{border-collapse:collapse;border-spacing:0} /* FIN reset */ /* DEBUT CSS diaporama */ .diaporama, .diaporama:after { position: fixed; width: 100%; height: 100%; top: 0px; left: 0px; z-index: 0; } .diaporama li span { width: 100%; height: 100%; position: absolute; top: 0px; left: 0px; color: transparent; background-size: cover; background-position: 50% 50%; background-repeat: none; opacity: 0; z-index: 0; -webkit-backface-visibility: hidden; -webkit-animation: imageAnimation 36s linear infinite 0s; -moz-animation: imageAnimation 36s linear infinite 0s; -o-animation: imageAnimation 36s linear infinite 0s; -ms-animation: imageAnimation 36s linear infinite 0s; animation: imageAnimation 36s linear infinite 0s; } .diaporama li:nth-child(1) span { background-image: url(images/1.jpg); } .diaporama li:nth-child(2) span { background-image: url(images/2.jpg); -webkit-animation-delay: 6s; -moz-animation-delay: 6s; -o-animation-delay: 6s; -ms-animation-delay: 6s; animation-delay: 6s; } .diaporama li:nth-child(3) span { background-image: url(images/3.jpg); -webkit-animation-delay: 12s; -moz-animation-delay: 12s; -o-animation-delay: 12s; -ms-animation-delay: 12s; animation-delay: 12s; } .diaporama li:nth-child(4) span { background-image: url(images/4.jpg); -webkit-animation-delay: 18s; -moz-animation-delay: 18s; -o-animation-delay: 18s; -ms-animation-delay: 18s; animation-delay: 18s; } .diaporama li:nth-child(5) span { background-image: url(images/5.jpg); -webkit-animation-delay: 24s; -moz-animation-delay: 24s; -o-animation-delay: 24s; -ms-animation-delay: 24s; animation-delay: 24s; } .diaporama li:nth-child(6) span { background-image: url(images/6.jpg); -webkit-animation-delay: 30s; -moz-animation-delay: 30s; -o-animation-delay: 30s; -ms-animation-delay: 30s; animation-delay: 30s; } /* Animation diaporama images */ @-webkit-keyframes imageAnimation { 0% { opacity: 0; -webkit-animation-timing-function: ease-in; } 8% { opacity: 1; -webkit-animation-timing-function: ease-out; } 17% { opacity: 1; } 25% { opacity: 0; } 100% { opacity: 0; } } @-moz-keyframes imageAnimation { 0% { opacity: 0; -moz-animation-timing-function: ease-in; } 8% { opacity: 1; -moz-animation-timing-function: ease-out; } 17% { opacity: 1; } 25% { opacity: 0; } 100% { opacity: 0; } } @-o-keyframes imageAnimation { 0% { opacity: 0; -o-animation-timing-function: ease-in; } 8% { opacity: 1; -o-animation-timing-function: ease-out; } 17% { opacity: 1; } 25% { opacity: 0; } 100% { opacity: 0; } } @-ms-keyframes imageAnimation { 0% { opacity: 0; -ms-animation-timing-function: ease-in; } 8% { opacity: 1; -ms-animation-timing-function: ease-out; } 17% { opacity: 1; } 25% { opacity: 0; } 100% { opacity: 0; } } @keyframes imageAnimation { 0% { opacity: 0; animation-timing-function: ease-in; } 8% { opacity: 1; animation-timing-function: ease-out; } 17% { opacity: 1; } 25% { opacity: 0; } 100% { opacity: 0; } } /* FIN CSS diaporama */ .menu{ width: 100%; background: #000; color: #FFF; z-index: 9999; position: relative; opacity: 0.5; text-align: center; height: 50px; } .menu p{ padding:15px; font-size: 20px } </style> </head> <body> <div class="menu"> <p>MENU</p> </div> <ul class="diaporama"> <li> <span>Image 01</span> </li> <li> <span>Image 02</span> </li> <li> <span>Image 03</span> </li> <li> <span>Image 04</span> </li> <li> <span>Image 05</span> </li> <li> <span>Image 06</span> </li> </ul> </body> </html>
a+
</code>
du coup c'est le quel le meilleur?
je deconseille ce reset !
Le problème de cette technique, c'est qu'elle annule certains styles par défaut des navigateurs qui sont réellement utiles. Comme par exemple celui des éléments de formulaire !
soit tu utilise un reset (voila les liens Meyer ,Normalise ) ou tu peux aussi utiliser une feuille de style css de base comme KNACSS et ensuite de la meme maniere q'avec un reset tu met ta propre css! comme cela
pour plus de details voir https://www.alsacreations.com/astuce/lire/36-reset-css.html
a+