圆形放大的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>
本文来自博客园,作者:小珍珠在河里敲代码,转载请注明原文链接:https://www.cnblogs.com/Jansens520/p/18070273
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术
· .NET周刊【3月第1期 2025-03-02】