CSS nth child on list items

html div block with unordred list items.

<div id="my-div">
    <ul>
        <li>item 1</li>
        <li>item 2</li>
        <li>item 3</li>
    </ul>
</div>

css to make the list to layout the item horizonally, hightlight the second item and remove the default bullet points in front of each item.

#div ul li
{
    margin-right:5px;
    float: left;
    list-style: none;
}

#div ul li:nth-child(2)
{    
    color:red;
}
  • item 1
  • item 2
  • item 3

Search within Codexpedia

Custom Search

Search the entire web

Custom Search