设置父div的某些div

时间:2016-12-06 21:31:48

标签: html css css3

我试图在我的标记中定位特定的div以使用CSS隐藏它们。我定位的两个div位于标有“row-20”的div中。这两个div被命名为back-button-block和forward-button-block。我正在使用以下CSS,但它不起作用。任何帮助将不胜感激。

.row-20 > .back-button-block, .row-20 > .forward-button-block,  { display:none; }
<div class="row-20">
                          <!-- Back Button -->
                          <div class="back-button-block">
                             Back
                          </div>
                          <!-- Back button ends -->
                              <!-- forward Button -->
                          <div class="forward-button-block swiper-button-disabled">
                            Forward
                          </div>
                          <!-- Forward button ends -->
                          <h1 class="question">NEXT</h1>
</div>

1 个答案:

答案 0 :(得分:1)

你有一个尾随的逗号,它会杀死你的选择器。

.row-20 > .back-button-block,
.row-20 > .forward-button-block
{
  display: none;
}
<div class="row-20">
  <!-- Back Button -->
  <div class="back-button-block">
    Back
  </div>
  <!-- Back button ends -->
  <!-- forward Button -->
  <div class="forward-button-block swiper-button-disabled">
    Forward
  </div>
  <!-- Forward button ends -->
  <h1 class="question">NEXT</h1>
</div>