返回列表 发布新帖
查看: 88|回复: 0

[代码技巧] 子比主题 – 随机背景文字三栏组合广告位

[复制链接]
SunJu_FaceMall
社区贡献

315

主题

190

回帖

1万

积分

等级头衔
Icon组别 : 管理员
Icon等级 :

积分成就
   钻石 : 524 颗
   贡献 : 1849 点
   金币 : 12 枚
Icon在线时间 : 1297 小时
Icon注册时间 : 2024-11-22
Icon最后登录 : 2025-12-9

荣誉勋章

会员LV.1会员LV.2会员LV.3会员LV.4会员LV.5会员LV.6会员LV.7会员LV.8会员LV.9会员LV.10

风云·优秀版主

飞流名人堂成员

1

实名认证 手机认证 vip vip-year FLLTCN发表于 2025-10-8 22:01:15 | 查看全部 |阅读模式 浙江金华

资源无需等待,交易就趁现在,全面资源整合网络大咖云集,让你轻松玩转互联网!

您需要 登录 才可以下载或查看,没有账号?立即注册

×
这是一款子比主题随机背景文字三栏组合广告位,效果非常好看,左边两张图片,右边是随机背景文字的一个广告位的代码,有技术的自己适配一下手机端,我手机端给隐藏了,喜欢的自行部署吧!

image.webp

代码部署


HTML代码
直接将下面的代码放到:WP后台–>>外观–>>小工具–>>自定义HTML代码即可
  1. <div class="ercdh">
  2.     <div class="ercdh_1 ">
  3.         <div class="sbaner">
  4.             <a href="https://www.tfbkw.com/" target="_blank">
  5.                
  6.             </a>
  7.         </div>
  8.         <div class="sbaner">
  9.             <a href="https://www.tfbkw.com/" target="_blank">
  10.                
  11.             </a>
  12.         </div>
  13.     </div>
  14.     <div class="ercdh_2">
  15.         <!-- 待写标签统计 -->
  16.         <section class="bqct mhs-flex-container">
  17.             <a href="https://www.tfbkw.com/" class="random-color">腾飞博客</a>
  18.         </section>
  19.         <section class="bqct mhs-flex-container">
  20.             <a href="https://www.tfbkw.com/" class="random-color">腾飞博客</a>
  21.         </section>
  22.         <section class="bqct mhs-flex-container">
  23.             <a href="https://www.tfbkw.com/" class="random-color">腾飞博客</a>
  24.         </section>
  25.         <section class="bqct mhs-flex-container">
  26.             <a href="https://www.tfbkw.com/" class="random-color">腾飞博客</a>
  27.         </section>
  28.         <section class="bqct mhs-flex-container">
  29.             <a href="https://www.tfbkw.com/" class="random-color">腾飞博客</a>
  30.         </section>
  31.         <section class="bqct mhs-flex-container">
  32.             <a href="https://www.tfbkw.com/" class="random-color">腾飞博客</a>
  33.         </section>
  34.         <section class="bqct mhs-flex-container">
  35.             <a href="https://www.tfbkw.com/" class="random-color">腾飞博客</a>
  36.         </section>
  37.         <section class="bqct mhs-flex-container">
  38.             <a href="https://www.tfbkw.com/" class="random-color">腾飞博客</a>
  39.         </section>
  40.         <section class="bqct mhs-flex-container">
  41.             <a href="https://www.tfbkw.com/" class="random-color">腾飞博客</a>
  42.         </section>
  43.         <section class="bqct mhs-flex-container">
  44.             <a href="https://www.tfbkw.com/" class="random-color">腾飞博客</a>
  45.         </section>
  46.     </div>
  47. </div>
复制代码

CSS代码
丢到:子比主题–>>自定义CSS样式即可
  1.     .ercdh {
  2.         display: flex;
  3.         overflow: hidden;
  4.     }
  5.    
  6.     .ercdh_1 {
  7.         display: grid;
  8.         grid-template-columns: repeat(2, 1fr);
  9.         gap: 10px;
  10.         padding-right: 30px;
  11.         position: relative;
  12.         width: 50%;
  13.     }
  14.    
  15.     .sbaner {
  16.         height: 80px;
  17.     }
  18.    
  19.     .ercdh_2 {
  20.         flex: 1;
  21.         padding-left: 30px;
  22.         display: grid;
  23.         grid-template-columns: repeat(5, 1fr);
  24.         gap: 0 15px;
  25.     }
  26.    
  27.     .mhs-flex-container {
  28.         display: flex;
  29.         justify-content: flex-start;
  30.         align-items: center;
  31.         align-self: auto;
  32.     }
  33.    
  34.     .random-color {
  35.         transition: background-color 0.5s;
  36.         color: #ececec;
  37.     }
  38.    
  39.     .bqct {
  40.         font-size: 14px;
  41.         display: flex;
  42.     }
  43.    
  44. .bqct a {
  45.     width: 100%;
  46.     border-radius: 6px;
  47.     background-color: var(--main-bg-color);
  48.     text-align: center;
  49.     font-weight: 400;
  50.     transition: background-color .3s, color .3s;
  51.     line-height: 30px;
  52.     color: #707070;
  53.     text-decoration: none;
  54. }
  55.    
  56.     .bqct a:hover {
  57.         color: #f1f2f3;
  58.     }
  59.    
  60.     .sbaner:after {
  61.         content: "";
  62.         display: inline-block;
  63.         background: #ececec;
  64.         position: absolute;
  65.         width: 1px;
  66.         height: 44px;
  67.         right: 0;
  68.         top: 50%;
  69.         -webkit-transform: translateY(-50%);
  70.         transform: translateY(-50%);
  71.     }
  72.    
  73.     .html-box img {
  74.         height: 80px;
  75.     }
  76. @media screen and (max-width: 1221px) { .ercdh{display:none; }
  77. }
复制代码

JS代码
直接丢到:子比主题–>>自定义javascript代码即可!
  1.     function getRandomColor() {
  2.         const letters = '0123456789ABCDEF';
  3.         let color = '#';
  4.         for (let i = 0; i < 6; i++) {
  5.             color += letters[Math.floor(Math.random() * 16)];
  6.         }
  7.         return color;
  8.     }

  9.     document.addEventListener('DOMContentLoaded', () => {
  10.         const sections = document.querySelectorAll('.random-color');
  11.         sections.forEach(section => {
  12.             section.addEventListener('mouseover', () => {
  13.                 section.style.backgroundColor = getRandomColor();
  14.             });
  15.             section.addEventListener('mouseout', () => {
  16.                 section.style.backgroundColor = '';
  17.             });
  18.         });
  19.     });
复制代码

本帖被以下淘专辑推荐:

路虽远,行则将至;事虽难,做则必成。
您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

飞流广播+ 发布

系统消息:柒沐已经连续答对3道难题,逆天学霸谁与争锋?!#每日答题#
10-30 17:02
系统消息:柒沐已经连续答对10道难题,逆天学霸谁与争锋?!#每日答题#
10-09 09:07
系统消息:柒沐已经连续答对3道难题,逆天学霸谁与争锋?!#每日答题#
09-24 09:00
系统消息:柒沐已经连续答对3道难题,逆天学霸谁与争锋?!#每日答题#
09-11 11:40
系统消息:柒沐已经连续答对3道难题,逆天学霸谁与争锋?!#每日答题#
09-02 09:17
系统消息:柒沐已经连续答对3道难题,逆天学霸谁与争锋?!#每日答题#
08-27 08:56
系统消息:柒沐已经连续答对3道难题,逆天学霸谁与争锋?!#每日答题#
08-20 15:12
系统消息:柒沐已经连续答对3道难题,逆天学霸谁与争锋?!#每日答题#
08-03 10:22
系统消息:柒沐已经连续答对10道难题,逆天学霸谁与争锋?!#每日答题#
06-30 08:57
系统消息:柒沐已经连续答对3道难题,逆天学霸谁与争锋?!#每日答题#
06-18 09:14
系统消息:清风网络已经连续答对10道难题,逆天学霸谁与争锋?!#每日答题#
04-11 09:40
系统消息:清风网络已经连续答对3道难题,逆天学霸谁与争锋?!#每日答题#
04-10 09:31
系统消息:IXM77777已经连续答对3道难题,逆天学霸谁与争锋?!#每日答题#
04-09 13:44
系统消息:清风网络已经连续答对3道难题,逆天学霸谁与争锋?!#每日答题#
04-09 09:22
系统消息:柒沐已经连续答对10道难题,逆天学霸谁与争锋?!#每日答题#
04-09 08:52
系统消息:清风网络已经连续答对3道难题,逆天学霸谁与争锋?!#每日答题#
04-08 09:24
系统消息:柒沐已经连续答对3道难题,逆天学霸谁与争锋?!#每日答题#
04-07 09:02
系统消息:柒沐已经连续答对10道难题,逆天学霸谁与争锋?!#每日答题#
02-27 09:35
系统消息:柒沐已经连续答对3道难题,逆天学霸谁与争锋?!#每日答题#
02-26 09:06
系统消息:柒沐已经连续答对3道难题,逆天学霸谁与争锋?!#每日答题#
02-25 08:49
站内通告

提供资源交易、信息共享、靓号交流、技术变现、学习问答、兴趣娱乐等全面服务。

1.丰富功能系统,扩展社区特色玩法,打造最好的互联网聚集圈子。

2.准确信息真实交易,安全快捷又方便,让虚拟交易面对面。

3. 天上不会掉馅饼,话术骗术迷人心,切勿脱离平台线下交易,被骗与平台无关!

4. 欺诈骗钱,违规违法将视情受到警告&禁言&封号甚至检举至👮🏻‍♀️处理!

官方Q群:123129钉推群:BAYR2383 站长QQ:3220000000

投诉/建议/商务合作联系

fl@fllt.cn

严禁私下交易,被骗与本站无关。
违反交易细则,取证立查严惩。
  • 钉钉新帖推送群
  • 官方交流QQ群
  • 站长唯一微信号

👮曝光Ta|🧿小黑屋|📴手机页|飞流网 ( 渝ICP备2025054677号-1|电信增值许可 渝B2-20250789 )|网站地图

GMT+8, 2025-12-10 14:23 , Processed in 0.085167 second(s), 61 queries, MemCached On , Gzip On.

Based on XJ-TX X3.5 Licensed

飞流论坛 HanAnalytics icp Astro vhAstro-Theme

关灯 在本版发帖
扫一扫添加微信客服
QQ客服返回顶部
快速回复 返回顶部 返回列表