TVs. Consoles. Projectors and accessories. Technologies. Digital TV

Ul marker color. Add bullets or numbering to text. Create your own markers

There are two popular ways to change the color of bullets to be different from the text color.

Usage

Inside each element

  • we invest , and then we place the text inside it. In other words, instead of the traditional scheme

  • text
  • create a design

  • text
  • In this case, the color of the markers is determined by the color style property for the li selector, and the text color is determined by the span selector (example 1).

    Example 1: Using Nested Tags

    Color of text and bullets in the list

    • Violin
    • Guitar
    • Bagpipes
    • Organ organ
    • Celesta


    The result of this example is shown below (Figure 1).

    Rice. 1. Markers that differ in color from the main text

    Despite its simplicity, the method is inconvenient, especially with voluminous lists, because now you will have to add to each list item .

    Usage::before

    The point is this: we remove the original list markers via the list-style-type property and add our own markers using the ::before pseudo-element and the content property. This link allows you to insert any text or symbol before an element, in this case

  • . Moreover, the type of text (color, font, background, etc.) can also be controlled through styles, as demonstrated in example 2.

    Example 2: Using the ::before pseudo-element

    List marker color

    • North
    • South
    • West
    • East


    The result of this example is shown in Fig. 2.

    This tutorial article will focus on working with lists in CSS, you will learn how to change the type of bullet, the location of the bullet relative to the list item, create your own bullets, and even change the color of the bullet.

    I think you already know that HTML 5 uses two main types of lists (excluding description lists and menu items):

  • Related publications