css how to only make bold fonts for first
    set

前端 未结 4 1709
心在旅途
心在旅途 2021-01-21 21:27

I have 2 or more

相关标签:
4条回答
  • 2021-01-21 21:45

    Use the first child selector: >

    .menu > li {
        font-weight: bold;
    }
    

    Not that if you need to support IE6, you'll have to do it manually, as IE6 doesn't support the > selector:

    .menu li a {
        font-weight: bold;
    }
    .menu li ul li a {
        font-weight: normal;
    }
    
    0 讨论(0)
  • 2021-01-21 21:50

    You'll have to use the child selector and make the top-level <ul> unique by giving it some class:

    ul.top-level > li > a {
       font-weight: bold;
    }​
    

    Demo: http://jsfiddle.net/kJJw9/

    0 讨论(0)
  • 2021-01-21 21:54

    It will probably do it...

    ul.menu li a
    {
        font-weight:bold;
    }
    
    ul.menu li ul li a
    {
        font-weight:normal;
    }
    
    0 讨论(0)
  • 2021-01-21 21:54

    ul.menu li.collapsed a{font-weight:bold;}

    0 讨论(0)
提交回复
热议问题