Jump to content

CSS to limit blog excerpt to three lines?

Recommended Posts

Site URL: https://www.houseofzeus.ca

Hi, on my home page (scroll down for Recent Posts) and blog page, I included an excerpt for each post as a teaser. Currently, I am manually ensuring that they fall within three lines on the home page and within two lines on the blog page. Is there any way to make it so that the excerpts will show a maximum of three lines for any and all excerpts through a custom CSS code?

If possible, I would like this to be true for both desktop and mobile/ tablet view!

 

The password to the site is: test

Thank you!

Screenshot (812).png

Screenshot (813).png

Link to comment
15 hours ago, HoZ said:

@tuanphan I am on a Personal Plan at the moment! But planning to upgrade to Business Plan in a year (if that makes any difference).

Add to Page Settings > Advanced > Header

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script>
<script src="https://www.jqueryscript.net/demo/Cropping-Text-Without-Breaking-Words-jQuery-Limit-Text/limit.text.min.js"></script>
<script>
$(function () {
  $('.summary-excerpt p').addClass('cuttext');
$('.cuttext').limitText({
length: 140
});
})
</script>

 

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment
22 hours ago, tuanphan said:

Add to Page Settings > Advanced > Header


<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script>
<script src="https://www.jqueryscript.net/demo/Cropping-Text-Without-Breaking-Words-jQuery-Limit-Text/limit.text.min.js"></script>
<script>
$(function () {
  $('.summary-excerpt p').addClass('cuttext');
$('.cuttext').limitText({
length: 140
});
})
</script>

 

I won't be able to use this until I upgrade to a Business Plan, is that correct?

Link to comment
4 hours ago, HoZ said:

I won't be able to use this until I upgrade to a Business Plan, is that correct?

If you are on trial plan, you can use

Email me if you have need any help (free, of course.). Answer within 24 hours. 
Or send to forum message

How to: Setup Password & Share url Insert Custom CSS - Page Header - Upload Custom Font - Upload File - Find Block ID - Contact Customer Care

Link to comment
  • 2 years later...
On 7/15/2020 at 1:15 AM, tuanphan said:

Add to Page Settings > Advanced > Header

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.0/jquery.min.js"></script>
<script src="https://www.jqueryscript.net/demo/Cropping-Text-Without-Breaking-Words-jQuery-Limit-Text/limit.text.min.js"></script>
<script>
$(function () {
  $('.summary-excerpt p').addClass('cuttext');
$('.cuttext').limitText({
length: 140
});
})
</script>

 

Are these scripts for limiting text in summary blocks still working? I've tried adding to my page both in Header Injection and also in Advanced Code Injection (7.0) and neither are working. Thanks!

Hey, I'm Jin (he/him). I'm a front end dev learning to make custom sites in Squarespace.

If you find my suggestions helpful, please upvote & like!😺

 

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.