飞流 发表于 2025-10-9 00:20:19

子比主题 – 自适应多样式广告位小工具

这是一款子比主题自适应多样式的广告位小工具,我觉得这个小工具还是不错的,适配了手机端和电脑端,对于想卖广告位的站长非常的方便,话不多说直接开始!


代码部署
将下面的代码放到:WP后台–>>外观–>>小工具–>>自定义HTML即可!
<style>
    a{text-decoration:none}
    .ad{background:#fff0;overflow:hidden;clear:both;border-radius:6px;}
    .ad a{margin:2px;display:block;border-radius:3px;}
    .ad img{max-width:100%;border-radius:8px;}
    .ad li{float:left;width:50%;list-style:none;}
    @media(max-width:999px) {
    .ad{margin: 0 0 10px 0;}
    .ad li{width:100%;}
    }
    .txtguanggao{
      width: 100%;
      overflow: hidden;
      display: block;
      margin-top: -1px;
    }
    .txtguanggao a{
      width: calc((100% - 20px) / 4);
      float: left;
      border-radius: 2px;
      line-height: 35.35px;
      height: 35.35px;
      text-align: center;
      font-size: 14px;
      color: #fff;
      display: inline-block;
      background-color: rgb(255, 153, 159);
      margin: 2.5px;
      transition-duration: .3s;
    }
    .txtguanggao a:nth-child(1) { background-color: #dc3545; }
    .txtguanggao a:nth-child(2) { background-color: #007bff; }
    .txtguanggao a:nth-child(3) { background-color: #28a745; }
    .txtguanggao a:nth-child(4) { background-color: #ffc107; }
    .txtguanggao a:nth-child(5) { background-color: #28a745; }
    .txtguanggao a:nth-child(6) { background-color: #ffc107; }
    .txtguanggao a:nth-child(7) { background-color: #dc3545; }
    .txtguanggao a:nth-child(8) { background-color: #007bff; }
    .txtguanggao a:hover { background:#FF2805; color:#FFF; }
    @media screen and (max-width: 1000px) {
    .txtguanggao a {
      width: calc((100% - 10px) / 2);
      float: left;
      border-radius: 2px;
      line-height: 35.35px;
      height: 35.35px;
      text-align: center;
      font-size: 14px;
      color: #fff;
      display: inline-block;
      background-color: rgb(255, 153, 159);
      margin: 2.5px;
      transition-duration: .3s;
    }
    }
    @media screen and (min-width: 1000px) {
    .txtguanggao a {
      width: calc((100% - 20px) / 4);
    }
    }
    </style>
   
    <div class="ad">
    <!--·····顶部自适应图片广告开始·····-->
    <a href="https://www.tfbkw.com" target="_blank" >
    <picture>
    <!--↓↓↓电脑设备尺寸:1500x141px↓↓↓-->
    <source media="(min-width: 45em)" srcset="https://img.alicdn.com/imgextra/i1/2210123621994/O1CN01mzG05q1QbInS6gEow_!!2210123621994.png" width="100%">
    <!--↓↓↓手机设备尺寸:900x268px↓↓↓-->
    <source media="(min-width: 18em)" srcset="https://img.alicdn.com/imgextra/i1/2210123621994/O1CN01mzG05q1QbInS6gEow_!!2210123621994.png" width="100%">
    <!--↓↓↓当图片无法加载时显示备用图片↓↓↓-->
   
   
    </picture>
    </a>
    <!--·····顶部自适应图片广告结束·····-->
   
    <!--自适应文字广告-->
    <li><a href="https://www.tfbkw.com/" target="_blank" style="line-height:60px;height:60px;color:#fff;background:#e73038;text-align:center;font-size:24px;">大文字广告位</a></li>
    <li> <a href="https://www.tfbkw.com/"target="_blank" style="line-height:60px;height:60px;color:#fff;background:#ff8100;text-align:center;font-size:24px;">大文字广告位</a></li>
    </div>
   
    <!--底部小文字广告-->
    <div class="txtguanggao">
    <a href="https://www.tfbkw.com/" target="_blank" class="dh">超低价文字广告位</a>
    <a href="https://www.tfbkw.com/" target="_blank" class="dh">超低价文字广告位</a>
    <a href="https://www.tfbkw.com/" target="_blank" class="dh">超低价文字广告位</a>
    <a href="https://www.tfbkw.com/" target="_blank" class="dh">超低价文字广告位</a>
    <a href="https://www.tfbkw.com/" target="_blank" class="dh">超低价文字广告位</a>
    <a href="https://www.tfbkw.com/" target="_blank" class="dh">超低价文字广告位</a>
    <a href="https://www.tfbkw.com/" target="_blank" class="dh">超低价文字广告位</a>
    <a href="https://www.tfbkw.com/" target="_blank" class="dh">超低价文字广告位</a>
    </div>
页: [1]
查看完整版本: 子比主题 – 自适应多样式广告位小工具