为文章外部的标签添加随机彩色效果

admin
admin
管理员
532
文章
0
粉丝
综合评论107字数 174阅读0分34秒阅读模式

为文章外部的标签添加随机彩色效果

/*文章外部标签随机彩色*/
.item-tags a {
  padding: 5px 10px;
  border-radius: 5px;
  margin-right: 5px;
}

.item-tags a.meta-pay {
  background-color: #FFD700;  
  color: black;
}

.item-tags a.c-blue {
  background-color: #1E90FF;  
  color: white;
}

.item-tags a[href*="tag/"] {
  background-color: #FF69B4;  
  color: white;
}

javascript

var links = document.querySelectorAll('.item-tags a');

for (var i = 0; i < links.length; i++) {
  var randomColor = '#' + Math.floor(Math.random()*16777215).toString(16);
  links[i].style.backgroundColor = randomColor;
}

使用方法:

将上述CSS代码添加至zibil主题设置–全局&功能–自定义代码–自定义CSS样式中即可文章源自小武站1z345.cn小武站-https://50-0.cn/847.html

将上述javascript代码添加至zibil主题设置–全局&功能–自定义代码–自定义javascript代码中即可文章源自小武站1z345.cn小武站-https://50-0.cn/847.html

有单色需求自己改代码即可,大佬轻喷。文章源自小武站1z345.cn小武站-https://50-0.cn/847.html 文章源自小武站1z345.cn小武站-https://50-0.cn/847.html

  • 本文由 admin 发表于2024年8月17日 04:07:09
  • 转载请务必保留本文链接:https://50-0.cn/847.html
匿名

发表评论

匿名网友
确定