Free Ebook cover Complete CSS course

Complete CSS course

4.5

(2)

35 pages

Styling lists in CSS

Capítulo 13

Estimated reading time: 3 minutes

+ Exercise
Audio Icon

Listen in audio

0:00 / 0:00
Lists are very common elements on web pages, and we often need to style them to fit the design of the site. Fortunately, CSS gives us many options for customizing the look of our lists. The first thing we can do is change the style of bullets in lists. By default, unordered lists use a circular bullet and ordered lists use numbers. But we can change that using the "list-style-type" property. For example, to use a square bullet in an unordered list, we can do the following: ```html
  • Item 1
  • Item 2
  • Item 3
``` To use capital letters instead of numbers in a sorted list, we can use the "upper-alpha" value: ```html
  1. Item A
  2. Item B
  3. Item C
``` Also, we can completely remove bullets from lists using the value "none": ```html
  • Item 1
  • Item 2
  • Item 3
``` Another useful property for styling lists is "list-style-position". By default, bullets are to the left of the list item's text, but we can move them to the right using the "inside" value. This can be useful, for example, if we want to create a list of links that is aligned to the right of the page: ```html ``` Finally, we can also style the list items themselves, using the CSS properties we already know, such as "color", "font-size", "background-color", etc. For example, to create a list with a gray background and white text, we can do the following: ```html
  • Item 1
  • Item 2
  • Item 3
``` In summary, CSS list styling is quite versatile and allows us to create lists with different styles and layouts. It's worth exploring the available options and experimenting with different combinations to find the one that best suits our project.

Now answer the exercise about the content:

_Which CSS property can we use to change the style of bullets in lists?

You are right! Congratulations, now go to the next page

You missed! Try again.

The CSS property used to change the style of bullets in lists is "list-style-type". It allows you to modify the default circular bullets of unordered lists or numbers of ordered lists to different styles like square bullets or capital letters.

Next chapter

Styling Tables in CSS

Arrow Right Icon
Download the app to earn free Certification and listen to the courses in the background, even with the screen off.