CSS nth child on list items

html div block with unordred list items.
[code language=”html”]
<div id="my-div">
<ul>
<li>item 1</li>
<li>item 2</li>
<li>item 3</li>
</ul>
</div>
[/code]

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.
[code language=”css”]
#div ul li
{
margin-right:5px;
float: left;
list-style: none;
}

#div ul li:nth-child(2)
{
color:red;
}
[/code]

  • item 1
  • item 2
  • item 3

Search within Codexpedia

Custom Search

Search the entire web

Custom Search