• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2756

Original WordPress Tutorials & 6000+ Guaranteed Code

Snippets

  • Premium Access
  • Log in

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

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

Advertise · WPEngine · Genesis · Log in

  • Access Problems
  • Account Details
  • Consulting
 

Loading Comments...
 

You must be logged in to post a comment.