Skip to Main Content

How to Fix the Post Excerpt Length not working In the Elementor Post Widget with CSS

In this tutorial, I am going to show you how to fix the post excerpt length not working in Elementor post widget's with the help of CSS

Post Excerpt Length Not Working in Post Widget
UPDATE: Today (11the May 2022) Elementor Pro released version 3.7 which includes the feature to “Apply to custom Excerpt” This fixes the excerpt length issue.Excerpt length issueThe Excerpt Length in the post widget’s layout panel does not match the number you put in the field.It is quite frustrating and leaves a huge space in between the content when you disable the masonry option.Excerpt Length is not working in Post widget even though if you applied itThis happened to my blog page before and now it is fixed with the help of CSS.I want to show you how I did it step by stepThe applied excerpt length is not working in the Elementor  post widgetThis happens when you disable the Masonry effectsAfter adding the CSS, it fixed the issueequal height is achieved with some CSSYou can see, that I am not the only one who has this issue. See it for yourselves-
  1. Elementor’s forum
  2. GitHub
Here is the step-by-step tutorial on how to fix the Excerpt Length issue in the post widget with the help of CSS:

Provide CSS class to the post widget

Step#1(A): Click the Post widget handle and navigate to the Advanced tab-

Click the pencil icon to edit the post widgetPost widget handle advanced tab

Step#1(B): Give CSS class to the post widget

CSS class to Post widget- Advanced panel

Add Custom CSS to fix the excerpt length issue

We are going to use the -webkit-line-clamp CSS property to limit the contents to the specified number of lines.
The -webkit-line-clamp CSS property allows limiting of the contents of a block container to the specified number of lines.It only works in combination with the display property set to -webkit-box or -webkit-inline-box and the -webkit-box-orient property set to vertical.In most cases you will also want to set overflow to hidden, otherwise the contents won’t be clipped but an ellipsis will still be shown after the specified number of lines.When applied to anchor elements, the truncating can happen in the middle of the text, not necessarily at the end.
On the bottom of the panel, you will find Custom CSS, and there add this CSS.With LIne-clamp CSS property we limit the length of the linesThis CSS only works with post-excerpt
        
        
/*
    * This CSS only works with post excerpt
    * Adjust the line-clamp integer value.
    * Require Browser prefix to work. 
    * You can use the selector but using CSS class is much better
*/

.line-height .elementor-post__excerpt,
.line-height .elementor-post__excerpt p{
 -webkit-line-clamp: 3;     
    display: -webkit-box;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

        

Compatibility

When we use new CSS property, we often ask whether it is going to be compatible with the majority of the browser vendors but it turns out it supports over 95% globally which is excellent and safe to use.

  1. Can I use
  2. MDN Article

MDN shows 96% supports
Can I use Browser Compatibility check passes over 97% global use

Hope it helps.

Cheers

Thangjam Kishorchand

Thangjam Kishorchand

Hi there! I'm Kishorchand, and this is my blog where I share my Elementor tips and tricks that I've learned over the past two years. I'm mostly active on Quora and Facebook, and I love experimenting with design trends like variable fonts and dark mode.

Upgrade to Elementor pro Today

Scroll up further to Load all the comments...