Ajith
Ajith

Reputation: 305

How to make alternate li bold?

In a ul li list , how to make an alternate li bold. Like shown in the image.

enter image description here

Thanks

Upvotes: 2

Views: 170

Answers (2)

Priyank Patel
Priyank Patel

Reputation: 6996

You can do something like this

ul li:nth-child(odd)
{
font-weight:bold;
}

See Demo

Note:If you want to start from first li element then use odd if you want to start from second element then use even as alexn suggests in his answer.

Upvotes: 3

alexn
alexn

Reputation: 58962

Use the nth-child(even) pseudo selector:

li:nth-child(even) {
    font-weight: bold;
}

Use odd or even depending on whether you want the first one bold.

Demo on jsfiddle.

Upvotes: 7

Related Questions