仿小米logo

仿小米logo

 

图片链接:https://www.mi.com/

代码如下:

<style>
        .header-logo {
            position: relative;
        }
        /* 设置a标签的样式 */
        
        .logo {
            display: block;
            width: 55px;
            height: 55px;
            overflow: hidden;
            background-color: #ff6700;
            text-align: left;
            text-indent: -9999em;
        }
        /* mi logo的样式 */
        
        .logo::before {
            /* 定位 */
            position: absolute;
            /* 伪元素必须要设置content属性 */
            content: '';
            /* 左偏移 */
            left: 0;
            /* 上偏移 */
            top: 0;
            width: 55px;
            height: 55px;
            /* 设置过渡 */
            transition: all .3s;
            /* 背景图片 */
            background: url(./images/mi-logo.png) no-repeat center center;
            /* 透明度 */
            opacity: 1;
        }
        /* mi home 的样式 */
        
        .logo::after {
            position: absolute;
            content: '';
            left: 0;
            top: 0;
            width: 55px;
            height: 55px;
            transition: all .3s;
            background: url(./images/mi-home.png) no-repeat center center;
            margin-left: -55px;
            opacity: 0;
        }
        /* 鼠标移入 让mi logo 往右侧进行滑动 */
        
        .logo:hover::before {
            opacity: 0; 
            margin-left: 55px;
        }
        /* 鼠标移入 让mi home 回到盒子中间 */
        
        .logo:hover::after {
            opacity: 1;
            margin-left: 0;
        }
    </style>

没什么好分析的2333 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值