There are mainly two possible ways to truncate a long category list in the sidebar, they are JavaScript and CSS. Here, you will get a CSS solution with example code in this post.
In the CSS solution, you can set a specific height of your category list with “overflow” and “height” property.
WordPress Truncate Long Category List
To truncate a long WordPress category list widget, add following CSS code in “Additional CSS” setting. This Additional CSS setting is available in WordPress admin “Appearance / Customize / Additional CSS”.
.widget_categories ul{height:100px;overflow:auto;}
Here, “widget_categories” is the default class for WordPress category widget. So, above CSS code set static height for category widget with auto scroll style.
Note: In the above code category list height is set “100px”. You can increase this height value based on your blog or site design.
For example, 200px, 300px, 320px or other values which best fit with your site.
0 Comments
Post a Comment