常见CSS鼠标悬浮动画-hover属性
1. Grow-Shadow
鼠标移入盒子放大并出现底部阴影
效果:
代码
<div class="box"></div>
.box {
width: 200px;
height: 200px;
background-color: aqua;
-webkit-transform: perspective(1px) translateZ(0);
transform: perspective(1px) translateZ(0);
box-shadow: 0 0 1px rgba(0, 0, 0, 0);
-webkit-transition-duration: 0.3s;
transition-duration: 0.3s;
-webkit-transition-property: box-shadow, transform;
transition-property: box-shadow, transform;
}
.box:hover,
.box:focus,
.box:active {
box-shadow: 0 10px 10px -10px rgba(0, 0, 0, 0.5);
-webkit-transform: scale(1.1);
transform: scale(1.1);
}
2. Move-Shadow
鼠标移入盒子,盒子向上移动并出现底部阴影
效果:
代码
<div class="box"></div>
.box {
width: 200px;
height: 200px;
background: aqua;
-webkit-transform: perspective(1px) translateZ(0);
transform: perspective(1px) translateZ(0);
box-shadow: 0 0 1px rgba(0, 0, 0, 0);
position: relative;
-webkit-transition-duration: 0.3s;
transition-duration: 0.3s;
-webkit-transition-property: transform;
transition-property: transform;
&::before {
pointer-events: none;
position: absolute;
z-index: -1;
content: "";
top: 100%;
left: 5%;
height: 10px;
width: 90%;
opacity: 0;
background: -webkit-radial-gradient(
center,
ellipse,
rgba(0, 0, 0, 0.35) 0%,
rgba(0, 0, 0, 0) 80%
);
background: radial-gradient(
ellipse at center,
rgba(0, 0, 0, 0.35) 0%,
rgba(0, 0, 0, 0) 80%
);
/* W3C */
-webkit-transition-duration: 0.3s;
transition-duration: 0.3s;
-webkit-transition-property: transform, opacity;
transition-property: transform, opacity;
}
}
.box:hover,
.box:focus,
.box:active {
-webkit-transform: translateY(-5px);
transform: translateY(-5px);
&::before {
opacity: 1;
-webkit-transform: translateY(5px);
transform: translateY(5px);
}
}
3. Curl-Bottom-Right
鼠标移入盒子,盒子右下角卷起
效果:
代码
<div class="box"></div>
.box {
width: 200px;
height: 200px;
background: aqua;
-webkit-transform: perspective(1px) translateZ(0);
transform: perspective(1px) translateZ(0);
box-shadow: 0 0 1px rgba(0, 0, 0, 0);
position: relative;
&::before {
pointer-events: none;
position: absolute;
content: "";
height: 0;
width: 0;
bottom: 0;
right: 0;
background: white;
/* IE9 */
background: linear-gradient(
315deg,
white 45%,
#aaa 50%,
#ccc 56%,
white 80%
);
box-shadow: -1px -1px 1px rgba(0, 0, 0, 0.4);
-webkit-transition-duration: 0.3s;
transition-duration: 0.3s;
-webkit-transition-property: width, height;
transition-property: width, height;
}
}
.box:hover:before,
.box:focus:before,
.box:active:before {
width: 25%;
height: 25%;
}
这篇好文章是转载于:编程之路
- 版权申明: 本站部分内容来自互联网,仅供学习及演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,请提供相关证据及您的身份证明,我们将在收到邮件后48小时内删除。
- 本站站名: 编程之路
- 本文地址: /boutique/detail/tanhhfgekg
系列文章
更多
同类精品
更多
-
photoshop保存的图片太大微信发不了怎么办
PHP中文网 06-15 -
photoshop扩展功能面板显示灰色怎么办
PHP中文网 06-14 -
word里面弄一个表格后上面的标题会跑到下面怎么办
PHP中文网 06-20 -
《学习通》视频自动暂停处理方法
HelloWorld317 07-05 -
TikTok加速器哪个好免费的TK加速器推荐
TK小达人 10-01 -
Android 11 保存文件到外部存储,并分享文件
Luke 10-12 -
excel下划线不显示怎么办
PHP中文网 06-23 -
微信公众号没有声音提示怎么办
PHP中文网 03-31 -
excel图片置于文字下方的方法
PHP中文网 06-27 -
微信运动停用后别人还能看到步数吗
PHP中文网 07-22