欢迎与我联系   

念两句诗

醉卧古藤阴下,了不知南北。
【宋代】秦观《好事近·梦中作》

圆形放大的hover效果

复制代码
<template>
  <div class="container">
    <div class="avatar"></div>
  </div>
</template>

<script lang="ts" setup>
import { ref } from 'vue';
</script>
<style lang="scss" scoped>
//  clip-path: circle(); // 以元素的中心点为圆的中心点,最小宽度一半为圆的半径。
//  clip-path: circle(50%);  // 半径50%;
//  clip-path: circle(at 50% 50%); // 中心点位置在x:50%,y:50%。
//  clip-path: circle(50% at 50% 50%); // 半径50%;中心点位置在x:50%,y:50%。
//  clip-path: circle(50px at 50px 50px); // 半径50px;中心点位置在x:50px,y:50px。
.avatar{
  background: url('https://picsum.photos/200/300') center;
  width: 200px;
  height: 200px;
  border-radius: 50%;
  cursor: pointer;
  position: relative;
  border: 5px solid #000;
}
.avatar::before,.avatar::after{
  content: '';
  position: absolute;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  transition: all 0.3s;
  left: 0;
  top: 0;
}
.avatar::before{
  background: rgba(0,0,0,0.5);
}
.avatar::after{
  background: inherit;
  clip-path: circle(0% at 50% 50%);
}
.avatar:hover::after{
  clip-path: circle(50% at 50% 50%);
}
</style>
复制代码

 

posted @   小珍珠在河里敲代码  阅读(17)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术
· .NET周刊【3月第1期 2025-03-02】
点击右上角即可分享
微信分享提示

喜欢请打赏

扫描二维码打赏

了解更多