All things Shopify and commerce
Hello There ,
Is there any way to edit in the product card in such a way that if the title exceeds more than 2 line it should cut off the title with "..." at the end. Like this
Thank You !!
★ Did my post help? If yes, then please like and accept solution. ★
https://stephens.world
support@stephensworld.ca
Hi ,
I used this code , but in the title end "...." is not coming when the line breaks.
h3.product-grid-item__title {
display: -webkit-box;
-webkit-box-orient: vertical;
overflow: hidden !important;
text-overflow: ellipsis !important;
-webkit-line-clamp: 1;
max-height: 2.5em; /* Adjust this value as needed */
white-space: normal !important;
word-break: break-word;
}
In Shopify, you can control the display of product titles in your product cards using CSS to limit the number of lines and add an ellipsis (...) for longer titles. Here's how you can achieve this.
Once you're in the stylesheet file, add the following CSS code to control the display of the product title:
.product-title {
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
overflow: hidden;
}
This CSS code uses the -webkit-line-clamp property to limit the number of lines to 2. Adjust the value if you want a different number of lines.
5. Save Changes:
Save the changes to your stylesheet file.
6. Preview and Test:
Go back to the "Theme Editor" and preview your changes.
Test the product cards to see if the product titles are now truncated after two lines with an ellipsis.
Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024