开发者

CSS styling A href inside <li>

开发者 https://www.devze.com 2023-03-06 12:02 出处:网络
I have menu like that <ul id=\"menu\"> <li> <a href=\"/\">Home</a> </li> <li class=\"menu-selected\">

I have menu like that

  <ul id="menu">
      <li>
        <a href="/">Home</a>
      </li>
      <li class="menu-selected">
        <a href="/Results">Results</a>
      </li>
    </ul>

I want to make menu item selected after it was clicked. I set li class "menu-selected" But no luck.

.menu-selected ul#menu li a  //also i was trying to sa开发者_运维百科y a:link but no luck
 {
    background-color: #91c05e !important;
    text-decoration: none !important;
    color: #fff !important;
}

Any ideas?


ul#menu li.menu-selected a

is what you want to do


I'm pretty sure you want

ul li.menu-selected a

instead, since that applies to all links inside <li> elements with class menu-selected.


do:

ul#menu li.menu-selected a

From left to right it's parent -> child element

You probably only need .menu-selected a

0

精彩评论

暂无评论...
验证码 换一张
取 消