【问题标题】:Can't Figure out how to display: none for the following class无法弄清楚如何显示:以下课程无
【发布时间】:2018-10-23 10:26:45
【问题描述】:

我是 HTML 和 CSS 方面的新手,我主要使用它来对我的网站进行自定义更改,所以如果这是一个非常基本的问题,我深表歉意,但到目前为止我在网上任何地方都找不到答案。

我正在尝试从我的作者简介中删除“总阅读次数”行,但保留“总帖子”行。

这很容易接受“Total Reads”和“Total Posts”都具有“row”类名并且都包含“col total-label text-right”等相同的类,所以我不能设置一个显示:无,而不影响两者。有谁知道我如何绕过这个,我已经尝试了大约十几种不同的东西,但在网上找不到任何东西。

这是我网站上一个示例作者页面的链接:https://www.thepostmillennial.com/members/barbrakay/

提前致谢!

【问题讨论】:

    标签: html css wordpress display


    【解决方案1】:

    如果您不想在 HTML 中添加任何类。那么你可以做这样的事情。

    这里 .user-total 是行的父元素

    对于隐藏总读取数:

    .user-totals row:first-child {
      display: none
    }
    

    .user-totals row:nth-child(1) {
      display: none
    }
    

    隐藏帖子总数:

    .user-totals row:last-child {
      display: none
    }
    

    .user-totals row:nth-child(2) {
      display: none
    }
    

    【讨论】:

      【解决方案2】:

      尝试像这样在你的 CSS 中添加一个隐藏类

      .hide {
        display:none;
      }
      

      并将这个类添加到你想要隐藏的 HTML 元素中

      <div class="row hide">...</div>
      

      此方法可帮助您根据需要隐藏其他元素

      【讨论】:

        【解决方案3】:

        你可以使用它只会删除第一行

        #buddypress .bbp-user-report .user-totals .row:first-of-type { display:none }
        

        或者你可以做内联样式

        <div class="row" style="display:none;">
        

        【讨论】:

          【解决方案4】:

          在要删除的行上添加:

          <div class="row" style="display:none;">
          

          这只会特别影响该行。

          【讨论】:

            猜你喜欢
            • 2023-01-29
            • 1970-01-01
            • 2014-12-18
            • 2013-05-19
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            • 1970-01-01
            相关资源
            最近更新 更多