[英]CSS hide all elements, except one with certain child
I have this element here: 我在这里有这个要素:
#ihf-main-container .col-xs-6
I want to hide all the .col-xs-6
inside #ihf-main-container
, except the .col-xs-6
element that has .ihf-for-sale-price
inside of it....How would I accomplish this? 我想将所有
.col-xs-6
隐藏在#ihf-main-container
,除了其中的.col-xs-6
元素,其中包含.ihf-for-sale-price
....我将如何完成这个?
Like Phiter says, there's no css selector for this case yet. 就像Phiter所说的,这种情况下还没有CSS选择器。 A parent selector will be available in CSS4.
父选择器在CSS4中可用。
$(".ihf-for-sale-price").parent().hide();
) $(".ihf-for-sale-price").parent().hide();
) I don't quite understand exactly but you could just name your last column as 我不太清楚,但是您可以将最后一列命名为
<.... class="col-xs-6 newName" > in html
And then in css you could do 然后在css中你可以做
.col-xs-6{
display = none;
}
.newName{
display = block;
}
Hope this works but I feel I could help you better if you could add some pseudo code with the question. 希望这能奏效,但我想如果您可以在问题中添加一些伪代码,我会为您提供更好的帮助。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.