Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

How do I style multiple <li> list tags ?

Featured Replies

Hi WDF.

 

I'm looking to to use multiple lists on one page that will be required to be styled differently, so 3 variant's using different colours & different bullet styles.

 

What i'm having trouble with is how to actually style a li tag and how to create different li styles on one page.

 

I thought i'd ask the experts here before I search else where.

 

Many thanks. :)

If you need to style the same elements in different way within the same page, my way of doing it would be this:

 

First in you page, make sure you give id's(or classes) to your lists

 

<ul id="first_list">
<li><a href="#">item one</li>
<li><a href="#">item two</li>
<li><a href="#">item three</li>
</ul>

<ul id="second_list">
<li><a href="#">item one</li>
<li><a href="#">item two</li>
<li><a href="#">item three</li>
</ul>

<ul id="third_list">
<li><a href="#">item one</li>
<li><a href="#">item two</li>
<li><a href="#">item three</li>
</ul>

 

Then from your stylesheet, adress each list this way:

 

#first_list li {
whateverstyle: youneed;
}

#second_list li {
whateverstyle: youneed;
}

#third_list li {
whateverstyle: youneed;
}

 

Et voila!

 

Hope this helps

 

Oli

  • Author

Amazing! It worked! I have seperate styled lists on my page, i'll have to show you when I put it live.

 

It's good because I can now take the idea of styling seperate li's and incorporate it into other html tags.

 

Much appreciated. :clapping:

 

Regards

cool, I'm pleased it helped ;)

give me a shout if you need anything else

 

Oli

Nice one Olivier - couldn't have coded it any better myself - you beat me to it!

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.