Recently, when I was maintaining a blog, I found that the distance between the ‘Most Viewed Posts’ (popular articles) list items in the sidebar is too small, and the text is crowded together, which not only affects the appearance, but also makes it difficult for readers to browse quickly. After some tossing, I finally solved this problem perfectly through custom CSS. This article will complete the operation steps and attach code that can be used directly, hoping to help friends who encounter the same troubles.
Problem status: The default spacing is too compact
As you can see from the figure below, the list items are next to each other, and there is a visual lack of breathing, especially when the title is long and the line is crowded:

⚠️ Reminder of misunderstanding: The ‘extra CSS’ that comes with the block is a ‘trap’
Many friends (including me) will think of the ‘extra CSS’ input box in the ‘Advanced’ setting of the block editor for the first time (see the picture below), and then paste the complete selector code in full of confidence, and it turns out thatUnchanged.

Look carefully at this input boxBelowIn fact, there is a line of gray words:
‘Add your own CSS to customize the appearance of the most viewed posts block. You do not need to include a CSS selector, Just add the property and value, e.g. color: red;
The translation is:You don’t need to write selectors, just write properties and values, for example color: red;.
This means:
- This input box only acceptsSimple CSS Statement(such as
margin-bottom: 20px;), - The style will be applied to the block’soutermost container((
<div>) on, - Can’t go deep inside
<li>ElementTo adjust the spacing of list items.
And when I didn’t notice this line at all, I pasted the whole line repeatedly. .wp-block-post-views-counter-most-viewed-posts ol li { ... }, there is no effect, and a lot of time is wasted to check the cache and theme conflicts. It was not until I accidentally saw the line of instructions that I suddenly realized that the ‘road’ was wrong.
so,The ‘extra CSS’ that comes with the block is not suitable for our needs, it must be a different method.
✅ Correct Scheme: Take advantage of the global ‘extra CSS’ of the Site Editor (FSE)
If you are using a WordPress block theme (i.e., a full site editing theme), add a custom CSS via the following path:
operating steps
- Enter the WordPress background and click the menu on the left Appearance → Edit(or ‘Editor’), openSite Editor(site editor).
(If your theme doesn’t have an ‘Edit’ option, the instructions are not block themes, you can still use the extra CSS in ‘Appearance → Customization’, but this article is for block theme environments.) - At the top of the site editor, click ‘Style’ The icon (usually a circular palette or pencil icon) will pop up the style panel on the right.
- In the Styles panel, scroll down to find ‘Extra CSS’ part (as shown below).
- Paste the CSS code we prepared completely into the text box, then click ‘Save’ and released.
- Clear the site cache (plug-in cache, CDN, etc.) and refresh the foreground page to see the effect.

📝 Detailed CSS code
I have used code with clear comments for future adjustments. The core logic is:
- Increase the bottom margin for each list item (
margin-bottom) to open the vertical spacing; - Add light dividing lines (
border-bottom) to make the entries more clear; - The last one removes excess margins and dividing lines to keep it clean;
- Fine-tune the style of counting numbers to make it more harmonious.
/* ==========================================================================
🔥 热门文章列表间距优化
解决:增加列表项之间的垂直间距,添加分割线提升可读性,优化计数样式。
========================================================================== */
/* 热门文章列表项间距优化(适用于整个网站) */
.wp-block-post-views-counter-most-viewed-posts ol li {
margin-bottom: 20px; /* 列表项之间的垂直间距,可按需加大(如 24px) */
padding-bottom: 6px; /* 内部下内边距,增加呼吸感(可选) */
border-bottom: 1px solid #e5e5e5; /* 浅色分割线,让层次更清晰(可选) */
}
/* 最后一项去掉底部边距和分割线,保持整洁 */
.wp-block-post-views-counter-most-viewed-posts ol li:last-child {
margin-bottom: 0;
border-bottom: none;
}
/* 让计数数字与标题更和谐(可选) */
.wp-block-post-views-counter-most-viewed-posts ol li .count {
margin-left: 8px;
font-size: 0.85em;
color: #999;
}🎯 Final effect: comfortable spacing, clear layers
After applying the above style, the list of popular articles has become dense, and there is a clear interval between each content. The dividing line further guides the sight, and the overall browsing experience has been greatly improved:

Comparing the screenshots before and after adjustment (Figure 1 and Figure 5), the effect is immediate. If you think the 20px spacing is not large enough, just modify margin-bottom value, for example, to 28px Or 32px can.
💡 Notes
- If the theme’s own style has a higher priority, you can add it after the attribute value
!importantmandatory coverage (such asmargin-bottom: 20px !important;). - Be sure to clear the site cache (plug-in cache, CDN cache, etc.) and refresh the browser to avoid invisible updates.
- This selector is only for
wp-block-post-views-counter-most-viewed-postsThis specific block will not affect other lists, so use it with confidence. - If your theme is not a block theme (without the ‘Edit’ menu), use the extra CSS in ‘Appearance → Customization’ as well.
Hope this blog can help you. If you encounter any problems in the operation, please leave a message to exchange!
Technical Blog Growth & Monetization Consulting
I have been running my personal technology blog for more than 10 years and have published over 1,000 original articles covering WordPress optimization, multilingual websites, Google SEO, content strategy, and website monetization. All insights shared on this site come from real-world operation and long-term experimentation. If you are building a blog, developer website, SaaS project, or content-driven platform, I would be happy to share practical experience and optimization suggestions.
Ideal For:
✅ Technical bloggers
✅ Independent developers
✅ SaaS website owners
✅ Content creators seeking organic traffic growth
✅ Website owners interested in monetization opportunities
What I Offer:
✅ WordPress Performance Optimization
✅ SEO Consulting
✅ Multilingual Website Setup
✅ Ad Revenue Optimization
✅ Blog Growth & Monetization Consulting
If you would like to discuss your website, traffic growth strategy, or monetization opportunities, please contact me and mention: Blog Growth Consultation.
Contact Me:
Telegram: @shuijingwan
WeChat: 13980074657
Email: shuijingwanwq@gmail.com


Leave a Reply