css how to only make bold fonts for first
    set

前端 未结 4 1749
心在旅途
心在旅途 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;
    }
    

提交回复
热议问题