# CSS隐藏群组成员页面中的“发布”和“已查看”列，第二版

**URL:** https://meta.discourse.org/t/css-to-hide-the-posted-and-seen-columns-in-the-group-member-page-take-2/253888
**Category:** Development
**Tags:** css
**Created:** [2023 年2 月 2 日 21:59 UTC](https://meta.discourse.org/t/css-to-hide-the-posted-and-seen-columns-in-the-group-member-page-take-2/253888 "2023-02-02T21:59:04Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### 作者： ![JoelZaslofsky](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/joelzaslofsky/32/158556_2.png) [@JoelZaslofsky](https://meta.discourse.org/u/JoelZaslofsky)
#### 发布日期： [2023 年2 月 2 日 21:59 UTC](https://meta.discourse.org/t/css-to-hide-the-posted-and-seen-columns-in-the-group-member-page-take-2/253888/1 "2023-02-02T21:59:04Z")

</div>

关于 2021 年 3 月的此论坛帖子：

> [@CSS to hide the Posted and Seen columns in the group member page](https://meta.discourse.org/t/css-to-hide-the-posted-and-seen-columns-in-the-group-member-page/182206/1):
>
> As of Discourse 2.7.0.beta4, some custom CSS we previously used to hide the Posted and Seen columns on the group detail page no longer works. Instead, we just have the “Seen” column. I want the only column between Posted, Seen, and Added to be the Added column. The CSS below previously worked but no longer does. /\* remove "Posted" and "Seen" columns from group-detail member lists \*/ table.group-members th:nth-child(n+4):nth-child(-n+5), table.group-members td:nth-child(n+4):nth-child…

用于隐藏桌面视图中群组成员详细信息列表中的“已发布”和“已查看”列的 CSS，现在会隐藏需要请求加入的群组的“接受”和“拒绝”按钮。

这是需要修改或替换的 CSS。

```css
/* 从群组成员详细信息列表中移除“已发布”和“已查看”列 */
.group-members {
  th {
    &:nth-child(5),
    &:nth-child(6) {
      display: none;
    }
  }
  td {
    &:nth-child(4),
    &:nth-child(5) {
      display: none;
    }
  }
}

```

这是显示使用 nth-child CSS 代码的权衡以及“接受”和“拒绝”按钮消失的视频：

[https://www.loom.com/share/d066ea1a765a4ce4b3b13a952f98fb1b](https://www.loom.com/share/d066ea1a765a4ce4b3b13a952f98fb1b)

提前感谢好心人提供更具针对性的 CSS，以便我可以在 https://[yourdiscourseforumurl].com/g/[YourGroupName] 上仅隐藏“已发布”和“已查看”列而不隐藏其他任何内容。

---

<div class="post-metadata">

### 作者： ![Don](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/don/32/228726_2.png) [@Don](https://meta.discourse.org/u/Don)
#### 发布日期： [2023 年2 月 3 日 10:25 UTC](https://meta.discourse.org/t/css-to-hide-the-posted-and-seen-columns-in-the-group-member-page-take-2/253888/2 "2023-02-03T10:25:07Z")

</div>

你好，

这有点棘手，因为据我所见，没有特定的类可以定位。但我认为我找到了 CSS 解决方案，无需修改模板即可实现。🙂

问题在于 `td` 没有特定的类可以轻松定位，但你可以定位它里面的内容。

此 CSS 将检查 `td` 中的内容，如果它是 `span`，它将隐藏（日期在 `span` 中）。但在请求页面上，按钮是 `button`，所以这个 CSS 不会隐藏按钮的 `td`。

```scss
/* 从 group-detail 成员列表中移除“Posted”和“Seen”列 */
table.group-members {
  th {
    &:nth-child(4),
    &:nth-child(5) {
      display: none;
    }
  }
  td {
    &:nth-child(4),
    &:nth-child(5) {
      > span {
        display: none;
      }
    }
  }
}

```

* * *

其他方法 🔽

但是，你可以定位表头行的 `bulk-select` 和表体行的 `group-owner` 类。此 CSS 仅在 `bulk-select` 和 `group-owner` 类出现时激活。这些类在请求页面上不出现，所以不会激活。

```scss
/* 从 group-detail 成员列表中移除“Posted”和“Seen”列 */
table.group-members {
  th.bulk-select {
    + th + th + th,
    + th + th + th + th {
      display: none;
    }
  }
  td.group-owner {
    + td + td,
    + td + td + td {
      display: none;
    }
  }
}

```

希望这有帮助 🙂

---

<div class="post-metadata">

### 作者： ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### 发布日期： [2023 年3 月 5 日 10:25 UTC](https://meta.discourse.org/t/css-to-hide-the-posted-and-seen-columns-in-the-group-member-page-take-2/253888/3 "2023-03-05T10:25:18Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
