css - 如何在 CSS 中添加微光效果
问题描述
我正在设计一个网站,并尝试在 CSS 代码中为图像添加微光效果。下面是添加我正在使用的微光效果的代码(来源:使 CSS 微光效果工作已加载的图像)
.shimmer {
color: grey;
display:inline-block;
-webkit-mask:linear-gradient(-60deg,#000 30%,#0005,#000 70%) right/300% 100%;
background-repeat: no-repeat;
animation: shimmer 2.5s infinite;
}
@keyframes shimmer {
100% {-webkit-mask-position:left}
}
我正在尝试在这行代码中将效果添加到图像中。
.bottomhalf{padding:10px;padding-bottom:4px;background-image:url("https://i.stack.imgur.com/MeQxk.png");background-size:contain;background-repeat:no-repeat;background-position:center center}
我不确定如何完成这项工作。如果有人能告诉我怎么做 - 甚至更改添加微光的代码 - 这将非常有帮助。谢谢你。
解决方案
这个 ?
.shimmer {
color: grey;
display:inline-block;
-webkit-mask:linear-gradient(-60deg,#000 30%,#0005,#000 70%) right/300% 100%;
background-repeat: no-repeat;
animation: shimmer 2.5s infinite;
}
.bottomhalf{
padding:10px;
padding-bottom:4px;
background-image:url("https://i.stack.imgur.com/MeQxk.png");
background-size:contain;
background-repeat:no-repeat;
background-position:center center
}
@keyframes shimmer {
100% {-webkit-mask-position:left}
}
<div class="shimmer bottomhalf"></div>
推荐阅读
- c - 创建多个命名管道
- java - 产生一致结果的非同步方法
- r - 使用 dplyr 查找组内的时间间隔
- java - 比较两个 ArrayList 中的元素并合并
- javascript - 为什么这些 HMTL5 数据属性返回一个函数而不是赋值?
- amazon-web-services - QuickSight - 随着时间的推移活动事件的计数
- java - 在 wicket 6.20 中允许 CORS
- ruby-on-rails - Rails 程序中的 cookie 是什么样的东西?
- navision - 没有副本在报告中不起作用
- asp.net - WordPress 不能在同一台机器上 AJAX 到 ASP.NET.Core Web 应用程序