Site logo

Archived topic

Numbered list styling

7 replies · Started by Nacho on March 22, 2019

Viewing posts 1–8 of 8

Hello,

How can I style the numbered lists like the image below?

I´ve been playing a bit with the CSS and the "before" but nothing.

Thanks a lot for your help.

Hi there,

try this:

ol {
    list-style: none !important;
    counter-reset: item;
    margin-left: 0 !important;
}

ol li {
    counter-increment: item;
    margin-bottom: 5px;
}

ol li:before {
    margin-right: 10px;
    content: counter(item);
    background: #bbb;
    border-radius: 100%;
    color: white;
    width: 1.2em;
    line-height: 1.2em;
    padding: 2px;
    text-align: center;
    display: inline-block;
}

Wow,

That worked like charm and super fast.

Thanks a lot David and have a nice day.

Glad to be of help

Hi David,

I´ve just found that the first line has padding but not the second and the ones below them so they look like in a box.

You can see in the URL of this post.

Thanks a lot.

Looks like you made some changes to the CSS, so update it to this:

ol {
    list-style: none !important;
    counter-reset: item;
    margin-left: 0 !important;
}

ol li {
    counter-increment: item;
    margin-bottom: 5px;
    position: relative;
    margin-left: 40px;
}

ol li:before {
    margin-right: 10px;
    content: counter(item);
    border-radius: 50%;
    border-top-color: rgb(212, 212, 212);
    border-top-style: solid;
    border-top-width: 1px;
    border-right-color: rgb(212, 212, 212);
    border-right-style: solid;
    border-right-width: 1px;
    border-bottom-color: rgb(212, 212, 212);
    border-bottom-style: solid;
    border-bottom-width: 1px;
    border-left-color: rgb(212, 212, 212);
    border-left-style: solid;
    border-left-width: 1px;
    border-image-outset: 0;
    border-image-repeat: stretch;
    border-image-slice: 100%;
    border-image-source: none;
    border-image-width: 1;
    color: #bbb;
    width: 1.2em;
    line-height: 1.2em;
    padding: 2px;
    text-align: center;
    position: absolute;
    left: -40px;
}

Hi David,

That worked perfectly.

Thanks a lot for such a quick reply.

Have a nice day.

You're welcome

This archived topic is closed to new replies.