Pen Settings



CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource


Babel includes JSX processing.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource


Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.


Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.


                <!DOCTYPE html>
<html lang="fr">
    <meta charset="UTF-8">
    <title>Galerie de Photos JavaScript</title>
    <link rel="stylesheet" href="css/style.css">
    <script src = "js/gallery.js"></script>

<div id = "image">
    Survole une image en-dessous pour l'afficher ici.

<img class="preview" alt="Stylé avec son Bandana" src="" onmouseover="upDate(this)" onmouseout="unDo()">

<img class = "preview" alt = "Avec mon gosse" src = "" onmouseover = "upDate(this)" onmouseout = "unDo()">

<img class = "preview" src = "" alt = "Petit Chiot" onmouseover = "upDate(this)" onmouseout = "unDo()">



                /*Nommez ce fichier externe style.css*/

    margin: 2%;
    border: 1px solid black;
    background-color: #b3b3b3;
    width: 575px;
    height: 650px;
    border:5px solid black;
    margin:0 auto;
    background-color: #8e68ff;
    background-image: url('');
    background-repeat: no-repeat;
    text-align: center;
    background-size: 100%;
    font-size: 150%;
    border: 10px solid black;


                /* Nommez ce fichier externe gallery.js*/

/* la fonction va changer l'image vers l'original et le texte vers celui présent dans la div d'origine */

function upDate(imgPrev){
      document.getElementById('image').style.backgroundImage = "url("+imgPrev.src+")";
        document.getElementById('image').innerHTML = imgPrev.alt;


/* function unDo()
Dans cette fonction {

1) Mettez à jour l'URL vers l'image d'arrière plan de la div avec id = "image"
vers l'image originale. Vous pouvez utiliser le code css poru voir quelle était l'URL originale

2) Changez le texte de la div avec l'id = "image" de retour vers le texte original. Vous pouvez utiliser le code html poru voir quel était le texte original


function unDo(){

document.getElementById('image').innerHTML = "Survole une image en-dessous pour l'afficher ici";
        document.getElementById('image').style.backgroundImage = "url('')";