문제

I have an horizontal navigation. Some links that has a drop down navigation. Something like this:

<ul>
    <li>
        <a>Title 1</a>
    </li>

    <li>
        <a>Title 2</a>
        <ul>
            <li><a>Link</a></li>
            <li><a>Link</a></li>
            <li><a>Link</a></li>
        </ul>
    </li>

    <li>
        <a>Title 3</a>
        <ul>
            <li><a>Link</a></li>
            <li><a>Link</a></li>
            <li><a>Link</a></li>
        </ul>
    </li>
</ul>

As you can see, "Title 1" not has a drop down menu but everybody else will. Is it possible to apply an icon only to links that have drop down menu?

도움이 되었습니까?

해결책

If you give your main ul an Id this can be achieved by following code:

ul#nav > li > a:only-child  {
    // Do something with link without dropdown  
}

ul#nav > li > a {
    // Do something with link with dropdown    
}

Here is an example in which I gave the links a specific color: http://jsfiddle.net/y2XtA/

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top