Lists


Many novice users are surprised that Tailwind's lists are not styled by default.

This means that whether we use <ol> or <ul>, they will have no bullets or numbers by default.

    Ordered list

  1. One
  2. Two
  3. Three

    Unordered list

  • One
  • Two
  • Three

But don't worry, Tailwind CSS offers us various utility classes to customize the appearance and behavior of lists. We can leverage these classes to style lists according to their design requirements.

Numbered list

Add .list-decimal to create a classic, ordered list with numbers:

  1. One
  2. Two
  3. Three

Bullet list

Add .list-disc to create a classic, unordered list with dots / small black circles:

  • One
  • Two
  • Three

List position

There is a small problem when we want to put a list, for example, next to a paragraph:

Lorem ipsum dolor sit amet consectetur adipisicing elit. Ipsum corporis eos reiciendis doloribus iure aut sint eligendi rerum, delectus ipsam. Velit amet fugit, ut facere quam inventore dolorem esse atque.

  • One
  • Two
  • Three

See the list bullets extend beyond the left paragraph boundary?

However, we can easily fix this by adding a .list-inside class to the list:

Lorem ipsum dolor sit amet consectetur adipisicing elit. Ipsum corporis eos reiciendis doloribus iure aut sint eligendi rerum, delectus ipsam. Velit amet fugit, ut facere quam inventore dolorem esse atque.

  • One
  • Two
  • Three

List with icons

Using what we learned about icons in previous lessons, we can create lists with icons.

List with checkmarks:
  • Item 1
  • Item 2
  • Item 3
List with arrows:
  • Item 1
  • Item 2
  • Item 3
List with question marks:
  • Item 1
  • Item 2
  • Item 3

Step 1 - add list with icons to the project

Now let's use the knowledge from this lesson and complete our "Details" section. Next to the carousel, we will insert a list with icons and text with a header.

After saving the file and refreshing the browser you should see content like this:

Details

This beginner-friendly, example-based course will guide you through the essential knowledge of TW Elements ecosystem.

What will you learn:

  • Tailwind
  • TW Elements
  • UI/UX design
  • Responsive web design



John Doe

About author

Michal Szymanski

Co Founder at TW Elements and MDBootstrap / Listed in Forbes „30 under 30" / Open-source enthusiast / Dancer, nerd & book lover.

Author of hundreds of articles on programming, business, marketing and productivity. In the past, an educator working with troubled youth in orphanages and correctional facilities.