• HTML,CSS实现鼠标划过头像,头像突出变大(附源码)


    话不多说,先上代码

    先看原图:

    ![在这里插入图片描述](https://img-blog.csdnimg.cn/e034a4b3905140298f8b729dd1e9ed54.png

    再看 鼠标放上去后的图:

    在这里插入图片描述

    是不是明显感觉到 人物头像突出了一些,而且还增加了阴影部分的效果呢?

    直接上代码!!!

    
    <div class="swiper-slide newly-slide newly-hover speakerList--q4JTz">
    	<a class="baseLink--8q29k" target="_blank" href="要跳转的路径">
    		<div class="speaker--r2ijq">
          		<div class="speakerPicBox--QeEr9">
               		<div>
               			<img src="图片路径" class="teacher-img" />
            		div>
               div> 
           div>
    	a>
    div>
    
    
    <style>
    .speaker--r2ijq{
       box-sizing: border-box;
       cursor: pointer;
       display: flex;
       padding: 8px 12px;
       width: 397px;
    }
    .speakerProfile--oCOCh{
     flex: 1 1;
     margin-left: 12px;
     overflow: hidden;
    }
    .speakerName--bKQtn{
     font-size: 22px;
     font-weight: 600;
     line-height: 22px;
     margin-bottom: 8px;
     overflow: hidden;
     text-overflow: ellipsis;
     white-space: nowrap;
     word-break: break-all;
     text-align: left;
     cursor: pointer;
     color: #535353;
     line-height: 33px;
     font-family: SourceHanSansCN-Bold, SourceHanSansCN;
     font-weight: bold;
    }
    .speakerDesc--vo1ea{
     -webkit-box-orient: vertical;
     -webkit-line-clamp: 2;
     color: #606060;
     display: -webkit-box;
     font-weight: 400;
     line-height: 22px;
     overflow: hidden;
     word-break: break-all;
     text-align: left;
     margin-top: 20px;
     width: 225px;
     height: 44px;
     max-width:225px;
     font-size: 12px;
     font-family: PingFangSC-Regular, PingFang SC;
     cursor: pointer;
    }
    
    .speakerList--q4JTz .speaker--r2ijq:hover .speakerPicBox--QeEr9:before{
       background-color: rgba(50,51,53,.1);
       bottom: 0;
       content: "";
       left: 0;
       margin: auto;
       position: absolute;
       right: 228px;
       top: 0;
       z-index: 1;
       width: 144px;
       height: 148px;
       border-radius: 12px;
    }
    .speakerList--q4JTz .speakerPicBox--QeEr9{
       border-radius: 12px;
       flex-basis: 144px;
       height: 148px;
       overflow: hidden;
    }
    .speaker--r2ijq:hover .teacher-img {
     transform: scale(1.1);
    }
    .speaker--r2ijq:hover .speakerName--bKQtn{
     color: #EA7336;
    }
    .teacher-more{
     display: inline-block;
     padding-top: 60px;
     float: right;
    }
    .teacher-more>a{
     color: #A3A3A3 !important;
    }
    .teacher-more>a:hover{
     color: #ff7020!important;
    }
    style>
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28
    • 29
    • 30
    • 31
    • 32
    • 33
    • 34
    • 35
    • 36
    • 37
    • 38
    • 39
    • 40
    • 41
    • 42
    • 43
    • 44
    • 45
    • 46
    • 47
    • 48
    • 49
    • 50
    • 51
    • 52
    • 53
    • 54
    • 55
    • 56
    • 57
    • 58
    • 59
    • 60
    • 61
    • 62
    • 63
    • 64
    • 65
    • 66
    • 67
    • 68
    • 69
    • 70
    • 71
    • 72
    • 73
    • 74
    • 75
    • 76
    • 77
    • 78
    • 79
    • 80
    • 81
    • 82
    • 83
    • 84
    • 85
    • 86
    • 87
    • 88
    • 89
    • 90
    • 91
    • 92
    • 93
    • 94
    • 95
    • 96
    • 97
    • 98
    • 99
    • 100

    大功告成,如上代码,就是鼠标滑过后,头像或图片突出的代码,快去试试吧!

    在这里插入图片描述

  • 相关阅读:
    Linux或者CentOS环境下部署.NET Core网站项目
    移动通信基础(14)均衡
    java计算机毕业设计基于安卓Android的助农商城APP-农业信息app-计算机毕业设计
    openGL 第章节 例子
    Python入门项目,从不会编程到完成这个小游戏,也就两天时间
    Web系统常见安全漏洞介绍及解决方案-sql注入
    【蓝桥杯大赛】简单回忆一下我的蓝桥杯比赛历程
    浅析MVC、MVP、MMVM 架构
    Stable Diffusion 的提示词使用技巧
    android studio的Android Drawable Preview
  • 原文地址:https://blog.csdn.net/weixin_47127690/article/details/134036184