B
B
Black_Fire2021-06-15 16:27:07
css
Black_Fire, 2021-06-15 16:27:07

How to style list item with custom marker?

It needs to be applied list-style-positionto lists, but since the standard marker has been canceled and a custom marker is used instead, the property does not work. It is necessary that there are indents as on the screen.

snippet here

60c8aa857c05d191947672.png

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Litvinenko, 2021-06-15
@AntonLitvinenko

ul.list {
  margin: 0;
  padding: 0;
  list-style-type: none;
  counter-reset: list-counter;
  li {
    position: relative;
    padding-left: 30px;
    &::before {
      counter-increment: list-counter;
      content: counters(list-counter,".") " ";
      position: absolute;
      left: 0;
      top: 5px;
      display: block;
      font-size: 12px;
    }
  }
}

S
SashaYue12345, 2021-06-15
@SashaYue12345

Through &:before or &:after, through background-image and absolute attach to li, and indent text in li

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question