Styling lists in CSS

Página 13

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.

Next page of the Free Ebook:

14Styling Tables in CSS

Earn your Certificate for this Course for Free! by downloading the Cursa app and reading the ebook there. Available on Google Play or App Store!

Get it on Google Play Get it on App Store

+ 6.5 million
students

Free and Valid
Certificate with QR Code

48 thousand free
exercises

4.8/5 rating in
app stores

Free courses in
video, audio and text