javascript - css隐藏同级div的问题?

 

问题描述:

image.png

期望的效果是箭头的div给隐藏掉


 

第 1 个答案:

.anchorTR div:last-child {
  display: none;
}

 

第 2 个答案:

  <div class="anchorTR">
    <div>div1</div>
    <div>div2</div>
    <div>div3</div>
  </div>
  <style>
    .anchorTR div:nth-of-type(3){
      color: #f00;
    }
  </style>

这样可以选择某一个元素,比如第3个,然后设置为display: none;就是隐藏它。


我通过点击下标‘∨’,点击奇数次的时候,出现2023年2月份的日历,点击偶数次的时候,不出现2023年2月份的日历。我是通过样式,来改变“2023年2月份”的日历出不出现的。当 ...