简体   繁体   English

CSS选择器(如果不为null)+嵌套

[英]CSS Selector (if not null) + nested

I am searching for something like 我正在寻找类似的东西

.class[height!= "0"] .span

Every time i try to nest something like 每当我尝试嵌套类似

div.item.class[height="0"] it didn't work. div.item.class[height="0"]无效。

Maybe someone can help me? 也许有人可以帮我吗? :) :)

Here is more Code: 这是更多代码:

HTML 的HTML

<div class="barWrapper">
                                        <ul id ="tabs" class="nav-bar" data-tabs="tabs">
                                            <li class="speed" style="height: 0%;"><a href="#Riesenslalom" data-toggle="tab"><span></span></a></li>
                                            <li class="speed" style="height: 0%;"><a href="#Speed" data-toggle="tab"><span></span></a></li>
                                            <li class="mixrace act" style="height: 100%;"><a href="#Mix_Race" data-toggle="tab"><span></span></a><em>1056</em></li>
                                            <li class="mixrace act" style="height: 5%"><a href="#Freeride" data-toggle="tab"><span></span></a><em>5</em></li>
                                            <li class="mixrace act" style="height: 70%"><a href="#Foto_Rallye" data-toggle="tab"><span></span></a><em>539</em></li>
                                            <li class="mixrace act" style="height: 10%"><a href="#Slalom" data-toggle="tab"><span></span></a><em>20</em></li>
                                            <li class="speed" style="height: 0%"><a href="#Buckelpiste" data-toggle="tab"><span></span></a></li>
                                            <li class="speed" style="height: 0%;"><a href="#Flug" data-toggle="tab"><span></span></a></li>
                                            <li class="mixrace act" style="height: 90%"><a href="#Carving" data-toggle="tab"><span></span></a><em>800</em></li>
                                            <li class="mixrace act" style="height: 100%"><a href="#Wandern" data-toggle="tab"><span></span></a><em>1200</em></li>
                                            <li id="line"></li>
                                        </ul>   
                                    </div>

CSS 的CSS

div.item.topStatistic .topStatistic-content .first .left .statisticWrapper .barWrapper ul > li span{position:absolute; bottom:0; width: 100%; height:40px; text-align: center; }
div.item.topStatistic .topStatistic-content .first .left .statisticWrapper .barWrapper ul > .speed span{background: url("icon_statistic_Speed.png") no-repeat transparent;}
div.item.topStatistic .topStatistic-content .first .left .statisticWrapper .barWrapper ul > .mixrace:not([height=0]) span{background: url("icon_statistic_active_MixRace.png") no-repeat transparent;}

Css has :not() as a pseudo selector. CSS具有:not()作为伪选择器。 So .class:not([height=0]) should work. 因此.class:not([height=0])应该可以工作。 http://caniuse.com/#search=:not http://caniuse.com/#search=:不是

您可以使用伪元素,它将为您工作,但问题是,它仅适用于主流浏览器,而不适用于ie8和blow

:not()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM