CSS中移動鼠標到一個盒子上,,會以動態顯示隱藏在后面的盒子


<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div{ 
            margin: 0 auto;
            top: 40px;
            width: 40px;
            height: 40px;
            background-color:pink;
            overflow: hidden;//隱藏周邊旋轉上來的超出盒子的部分
           
        }
        div::before{
            display: block; //偽類標簽是行級元素
            content: "張齊";
            width: 100%;
            height: 100%;
            background-color: red;
            transform-origin: left bottom; //將旋轉中心從默認的中點改為左下角
            transform: rotate(180deg); //將圖片旋轉180°
            transition: all 0.4s;        //過渡,就是讓旋轉的轉動減緩
        }  
       div:hover::before{
        transform: rotate(0deg); //當鼠標移動到轉到初始位置
       }
    </style>
</head>
<body>
    <div></div>
</body>
</html>
移動前的圖片

 

移動中的照片

 

移動后的照片

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM