Auto Increment Numbers Before List Items Using The counter-increment CSS Property

This CSS automatically adds numbers before each list item using the most recent posts widget native to all WordPress installations.

This solution helps when you don’t have access to the HTML or PHP code which generates the HTML.

Here’s the CSS you can simply copy & paste into your child themes style sheet and clear caching especially if using Chrome.

.sidebar-primary .widget_recent_entries li {
    list-style-type: none;
    counter-increment: auto-increment-numbers;
    display: flex;
}

.sidebar-primary .widget_recent_entries li::before  {
    content: counter(auto-increment-numbers);
    margin-right: 20px;
    font-size: 36px;
    color: #CCC;
    line-height: 36px;
}

Tested using the Genesis Sample child theme by StudioPress.

Uses CSS counters

Was This Tutorial Helpful?

Free

$0

Access only to all free tutorials per month.



Monthly

$75

Access to 10 premium tutorials per month.


Tutorial Request


Includes code guarantee and coding support.

Yearly

$500

Access to 15 premium tutorials per month.


Monthly Tutorial Request


Includes code guarantee and priority coding support.