Problem changing background image of active page in navigation bar

We have a problem with changing the background image of the active page in the navigation bar. Tried a lot of things, such as: active, .active, etc. In css, but did not work. We used nth-child to change the background images to freeze. Please help with your suggestions.

+3
source share
1 answer

Do not use nth-child encoding, which will not help change the background image of the active page. Use the following CSS code instead:

#uiList {
    margin: 0;
    padding: 0;
    list-style-type: none;
    background:url(../m1.png);
}

#uiList a{
    display:block;
    height:195px;
    width:78px;
}
.active{
    background:url(../m1_selected.png);
}

#uiList1 {
    margin: 0;
    padding: 0;
    list-style-type: none;
    background:url(../m2.png);
}

#uiList1 a{
    display:block;
    height:195px;
    width:78px;
}
.active1{
    background:url(../m2_selected.png);
}

Html code:
<ul id="uiList">
<li><a href="#"></a></li>
</ul>
<ul id="uiList1">  
<li><a href="#"></a></li>
</ul>
+5
source

All Articles