Jump to content

Force text to use "..." if line breaks and do not shift images.

Go to solution Solved by Ziggy,

Recommended Posts

Hey there! I have the Blog Title and Blog Excerpt to show/hide on hover which works perfectly. The issue when the excerpt shows on hover if it requires two lines it shifts all the other posts below it down which I think looks bad.

Could someone help me determine the best way to prevent that shift from happening? One solution could be to force ellipsis if there is a line break.

/*Hide Excerpt*/
.blog-basic-grid article .blog-basic-grid--text {
  .blog-excerpt{
   display: none !important; 
  }
}
/*Hide Title and Show Excerpt*/
.blog-basic-grid article:hover .blog-basic-grid--text {
  .blog-title{
   display: none !important; 
  }
   .blog-excerpt{
   display: inherit !important;
  }
}

@tuanphan @Ziggy

Link to comment
  • Solution

This is what you need to clamp the text to one line:

.blog-basic-grid .blog-excerpt p {
    margin: 0;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

Please like and upvote if my comments were helpful to you. Cheers!

Zygmunt Spray
Squarespace Website Designer
Contact me: 
https://squarefortytwo.com 
Hire me on Upwork!

🔌 Ghost Squarespace Plugins (Referral link)
📈 SEO Space (Referral link)
 SquareWebsites Plugins (Referral link)
 🔲 SQSP Themes (Referral link) 
Spark Plugin (Referral link) 
 🖼️ Pinch-to-Zoom Gallery Lightbox Plugin (Referral link) 

 Did I help? Buy me a coffee?

Link to comment
  • 2 months later...
On 10/12/2023 at 1:02 AM, JulieChristina said:

Hello, I was wondering how to apply this to certain text blocks (all miscellaneous font) on mobile if they are in a page and not a blog post? I've built a page of images with descriptions underneath. On desktop they look great but on mobile I want an ellipsis instead of spilling into a second line. Thanks.

 

website: https://www.holidayst.com/south-pacific

password: bonvoyage

You mean all text under product images on this page?

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

Contact Customer Care - Learn CSS - Buy me a coffee (thank you!)

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.