# 广告可以设置为不在类别页面显示吗？

**URL:** https://meta.discourse.org/t/can-ads-be-configured-to-not-be-shown-on-the-categories-page/365813
**Category:** Support
**Tags:** advertising
**Created:** [2024 年11 月 13 日 20:19 UTC](https://meta.discourse.org/t/can-ads-be-configured-to-not-be-shown-on-the-categories-page/365813 "2024-11-13T20:19:47Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### 作者： ![Clo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/clo/32/372138_2.png) [@Clo](https://meta.discourse.org/u/Clo)
#### 发布日期： [2024 年11 月 13 日 20:19 UTC](https://meta.discourse.org/t/can-ads-be-configured-to-not-be-shown-on-the-categories-page/365813/1 "2024-11-13T20:19:47Z")

</div>

太棒的插件了！

只有一个问题，有没有办法只在“分类”页面隐藏房源广告？或者只在分类框的底部显示它？

---

<div class="post-metadata">

### 作者： ![Clo](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/clo/32/372138_2.png) [@Clo](https://meta.discourse.org/u/Clo)
#### 发布日期： [2024 年11 月 26 日 09:51 UTC](https://meta.discourse.org/t/can-ads-be-configured-to-not-be-shown-on-the-categories-page/365813/2 "2024-11-26T09:51:32Z")

</div>

您好 👋

我最近为我的网站启用了广告插件，目的是展示内部广告。  
我已按照 [内部广告模板](https://meta.discourse.org/t/house-ad-templates/122004) 主题中的建议添加了内部广告代码。

但是，它在移动/响应式版本上一直与我主题的其余 CSS 样式冲突。

 ![WhatsApp Image 2024-11-15 at 21.26.44_1e286345](https://global.discourse-cdn.com/meta/original/4X/f/c/2/fc2f3ae1e028649d952b497b343f17c715fbaa56.jpeg)  
 ![WhatsApp Image 2024-11-15 at 21.26.44_812d6234](https://global.discourse-cdn.com/meta/original/4X/a/c/e/ace1685cf9041cdc2497c75a870b0fb9f7645f28.jpeg)

看起来类别框的容器宽度突然超出了屏幕大小。

这是我正在使用的 CSS 代码：

```plaintext
.banner-ad {
    display: flex;
    justify-content: center; /* 水平居中内容 */
    align-items: center; /* 在广告内垂直居中内容 */
    clear: both;
    width: calc(#{$topic-body-width} + #{$topic-avatar-width} + (#{$topic-body-width-padding} * 2)); /* 用于居中的显式宽度 */
    max-width: 100%; /* 确保它不会超出容器宽度 */
    box-sizing: border-box;
    margin: 15px auto; /* 居中广告并在上方和下方添加 15px 的边距 */
    text-align: center; /* 居中内联元素，例如图像 */

    img {
        display: block;
        margin: 0 auto; /* 在广告内居中图像 */
        max-width: 100%; /* 确保图像缩放到广告宽度 */
        height: auto; /* 保持纵横比 */
        max-height: 200px; /* 设置最大高度以限制图像 */
        object-fit: contain; /* 确保图像按比例缩放 */
        border-radius: 10px; /* 将圆角半径设置为 10px */

        &.desktop {
            display: block;
        }
        &.mobile {
            display: none;
        }
    }
}

@media only screen and (max-width: 100px) {
    .banner-ad {
        img.desktop, p {
            display: none;
        }
        img.mobile {
            display: block;
            margin: 0 auto; /* 居中移动端图像 */
            max-width: 80%; /* 确保移动端图像缩放到容器宽度 */
            height: auto; /* 保持纵横比 */
            border-radius: 10px; /* 也为移动端图像设置圆角 */
        }
    }
}

```

有什么建议如何解决这个问题吗？
