• Point d'origine

     

    Lorsque nous agrandissons un élément au survol, l'agrandissement prend effet à partir d'un point d'origine, qui est pas défaut l'angle haut/gauche; pour la rotation, c'est le centre !

    Ce point d'origine n'est pas toujours le bon, selon la position de l'élément.

    <div id="fd1">
    <p id="po1">&nbsp;</p>
    </div>
    <style><!--
    #fd1 {transform:translate(100px,10px); width:400px; height:400px; border:1px solid black; background-color:yellow;}
    #po1{position:absolute; transform:translate(0px,0px); width:200px; height:200px; background-color:green;}

     #po1:hover{width:400px; height:400px;}
    --></style>

     


     

    Lorsque nous plaçons notre élément ailleurs que dans l'angle haut/gauche, le point d'origine par défaut ne convient plus
    Nous allons imposer un autre point d'origine et, dans ce cas, ce sera l'angle bas/gauche


     

    Lorsque nous voulons voir l'agrandissement partir, par exemple, depuis l'angle bas/gauche:
    <div id="fd3">
    <p id="po3">&nbsp;</p>
    </div>
    <style><!--
    #fd3 {float:left; transform:translate(100px,10px); width:400px; height:400px; border:1px solid black; background-color:yellow;}
    #po3{transition:all 1s linear; position:absolute; z-index:1; transform:translate(0px,200px) ; transform-origin: bottom left; width:200px; height:200px; background-color:green; }
    #po3:hover{width:400px; height:400px; transform:translate(0px,0px)}
    --></style>

    L'écriture de transform-origin tolère les mots, les pixels et les pourcentages.


     

     

     

     

    Ce qui va nous permettre de réaliser ce genre de présentation, en utilisant une autre page déjà publiée: position:absolute; z-index:2; 
    <div id="fd4">
    <p id="po4">&nbsp;</p>
    <p id="po5">&nbsp;</p>
    <p id="po6">&nbsp;</p>
    <p id="po7">&nbsp;</p>
    </div>
    <style><!--
    #fd4 {float:left; transform:translate(100px,10px); width:400px; height:400px; border:1px solid black; background-color:yellow;}
    #po4{transition:all 1s linear; position:absolute; z-index:1; transform:translate(0px,0px) ; transform-origin: top left; width:200px; height:200px; background-color:green; }
    #po4:hover{width:400px; height:400px; transform:translate(0px,0px); z-index:2;}
    #po5{transition:all 1s linear; position:absolute; z-index:1; transform:translate(0px,200px) ; transform-origin: bottom left; width:200px; height:200px; background-color:red; }
    #po5:hover{width:400px; height:400px; transform:translate(0px,0px); z-index:2;}
    #po6{transition:all 1s linear; position:absolute; z-index:1; transform:translate(200px,0px) ; transform-origin: top right; width:200px; height:200px; background-color:blue; }
    #po6:hover{width:400px; height:400px; transform:translate(0px,0px); z-index:2;}
    #po7{transition:all 1s linear; position:absolute; z-index:1; transform:translate(200px,200px) ; transform-origin: bottom right; width:200px; height:200px; background-color:pink; }
    #po7:hover{width:400px; height:400px; transform:translate(0px,0px); z-index:2;}
    --></style>