basi c: выбор nth-child (odd) / even на li не работает: все они отображаются как нечетные - PullRequest
0 голосов
/ 09 июля 2020

Совершенно озадачен этими базовыми c правилами присвоения цвета фона по-разному, чтобы нечетный и четный каждому элементу списка (каждому <li>)

В визуализированном коде html ВСЕ li являются воспринимается как странное .. ?????? поэтому все они получили один и тот же цвет фона вместо необходимого альтернативного.

Благодарю за любую помощь.

<div id="technotes" class="block nb-coul well">
<div class="block-in">

<ul id="blocNotesTech">
         <li class="oneFile gc tips ">
 <a target="_blank" rel="tooltip" href="http:xxxx.pdf" title="" data-original-title="Enregistrer ce document (nl onglet) "><strong>xxxxxxxxxxxxxxxxx </strong>&nbsp;» 
</a> &nbsp;<span class="tout-pt-txt small">(0.16 Mo) </span><br>
<cite class="tout-pt-txt"><em>azertyui...</em>
</cite>

</li><br>
 <li class="oneFile hplc ">
 <a target="_blank" rel="tooltip" href="http:xxxx.pdf" title="" data-original-title="Enregistrer ce document (nl onglet) "><strong>xxxxxxxxxxxxxxxxx </strong>&nbsp;» 
</a> &nbsp;<span class="tout-pt-txt small">(0.16 Mo) </span><br>
<cite class="tout-pt-txt"><em>azertyui...</em>
</cite>


</li><br>
 <li class="oneFile gc tips ">
 <a target="_blank" rel="tooltip" href="http:xxxx.pdf" title="" data-original-title="Enregistrer ce document (nl onglet) "><strong>xxxxxxxxxxxxxxxxx </strong>&nbsp;» 
</a> &nbsp;<span class="tout-pt-txt small">(0.16 Mo) </span><br>
<cite class="tout-pt-txt"><em>azertyui...</em>
</cite>


</li><br>
 <li class="oneFile hplc ">
 <a target="_blank" rel="tooltip" href="http:xxxx.pdf" title="" data-original-title="Enregistrer ce document (nl onglet) "><strong>xxxxxxxxxxxxxxxxx </strong>&nbsp;» 
</a> &nbsp;<span class="tout-pt-txt small">(0.16 Mo) </span><br>
<cite class="tout-pt-txt"><em>azertyui...</em>
</cite>


</li><br>

</ul>

</div>

и css, который применяется (пробовал разными способами):

#technotes li{
    display: inline-block;
    background: none;
    background-position: center left!important;
    padding: 43px 2px 43px 72px!important;
    font-size: 130%;
    border-bottom: 1px blue !important;
}
#technotes li.hplc{
    background-image: url(../img/TechNoteHPLC-ico.png);
        background-repeat: no-repeat;

}
#technotes li.hplc-usp{
    background-image: url(../img/TechNoteHPLCUSP-ico.png);
        background-repeat: no-repeat;

}
#technotes li.gc{
    background-image: url(../img/TechNoteGC-ico.png);
        background-repeat: no-repeat;

}
#technotes ul > li:nth-child(odd){
    background-color: #f9f9f9;
}
#technotes ul > li:nth-child(even){
    background-color: #ECEDE6;
}

1 Ответ

0 голосов
/ 09 июля 2020

гррр. <br /> за пределами LI был проблемой ... должно быть внутри. решено ..

...