css隐藏同级div的问题?

image.png

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

阅读 1.9k
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;就是隐藏它。

.anchorTR div:last-child {
  display: none;
}
推荐问题