css动画阴影渐变效果

图片 hover 效果

.img {
  width: 100%;
  height: 100%;
  background-image: url(https://blog.csdn.net/"../../../styles/image/example.png");
  background-repeat: no-repeat;
  background-size: 100% auto;
  background-position: 50% 100%;
  transition: all 0.2s ease 0s; // 2. 动画效果  重点:当有css样式有变化时都可以使用此效果进行一个缓冲,增加柔和型
  -webkit-transition: all 0.2s ease 0s;
  &:hover {
    transform: scale(1.1); // 1. hover 放大
  }
}

图片覆盖层

> img {
  display: inline-block;
  max-width: 100%;
  max-height: 100%;
}

> div {
  width: 194px;
  height: 60px;
  background: rgba(31, 31, 31, 0.56);
  position: absolute;
  bottom: -60px; // 1. 定位
  left: 0;
  transition: transform 0.3s;
  transform: translateY(60px); // 2. 竖直方向上 向下移动
  color: rgba(255, 255, 255, 1);
  font-size: 12px;
  text-align: center;
  line-height: 60px;
}

&:hover {
  > div {
    transform: translateY(-60px); // 3. 竖直方向上 向上移动
    transition: transform 0.3s;
  }
}

盒子 hover 效果

&:hover {
  margin-top: 8px; // 1. 比之前的 margin-top 设置的 小写,形成向上偏移的效果
  box-shadow: 0px 4px 7px 3px rgba(124, 124, 124, 0.3); // 2. 盒子的阴影效果
}

设置一个渐变背景

.imgDisDiv {
  width: 100%;
  height: 34px;
  position: absolute;
  bottom: 0;
  right: 0;
  background: linear-gradient(
    0deg,
    rgba(89, 89, 89, 0.9) 0%,
    rgba(216, 216, 216, 0) 100%
  ); // 1. 线性渐变
  opacity: 0.82; // 2. 透明度
  .imgDis {
    font-size: 16px;
    color: #fff;
    margin-left: 14px;
    line-height: 34px;
  }
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值