css实现精致的角标

css实现精致的角标

参考:视觉还原小技巧!CSS 实现角标效果

image

纯色角标 -> 有白色到透明渐变的角标 -> 更精致有微弱高光的角标

.ribbon1 {
  margin: 0 60px;
  font-size: 34px;
  line-height: 70px;
  color: #fff;
  text-align: center;
  width: 200px;
  height: 70px;
  /* 透明遮罩+soft-light 给标签打上一层高光 */
  background: linear-gradient(135deg, rgba(255, 255, 255, .4), transparent) #ea3447;
  background-blend-mode: soft-light;
  display: inline-block;
  border-radius: 15px 15px 15px 0;
  position: relative;
}

.ribbon1::after {
  position: absolute;
  content: '';
  clip-path: polygon(0 0, 30px 0, 30px 30px);
  width: 30px;
  height: 30px;
  left: 0;
  bottom: -30px;
  /* 颜色变暗:filter滤镜、半透明遮罩 */
  /* 使用filter滤镜 使颜色变暗 */
  /*filter: brightness(.6);*/
  /* 给颜色上添加一个半透明遮罩实现颜色变暗 */
  background: linear-gradient(rgba(0, 0, 0, .3), rgba(0, 0, 0, .3));
  background-color: inherit; /* 继承 */
}

使用 filter: hue-rotate()色相旋转滤镜,得到更多颜色的角标

image
.ribbon1.hue1{
  filter: hue-rotate(90deg);
}
.ribbon1.hue2{
  filter: hue-rotate(190deg);
}
.ribbon1.hue3{
  filter: hue-rotate(264deg);
}
posted @   shine_lovely  阅读(1747)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 【.NET】调用本地 Deepseek 模型
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· DeepSeek “源神”启动!「GitHub 热点速览」
· 我与微信审核的“相爱相杀”看个人小程序副业
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库
历史上的今天:
2020-08-05 websocket应用场景
点击右上角即可分享
微信分享提示