How to Limit Product Tittle to 2 Lines Then show... in impulse theme version-2-5-2

Solved

How to Limit Product Tittle to 2 Lines Then show... in impulse theme version-2-5-2

Moeez
Tourist
5 0 4

Hello Everyone, I'm Facing a Issue while building store in impulse theme i try various methods to Limit product tittle to 2 lines but failed if anyone know's the method please let me know

 

Here's My Store URL : www.gizmeleon.shop

Accepted Solution (1)

devcoders
Shopify Partner
273 43 65

This is an accepted solution.

Hi @Moeez 

- Go to Online Store -> Theme -> Edit code.
- Find the file theme.scss.css and paste the code below at the bottom of the file.

 

.grid-product__title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

 



Shopify Developer: Helping eCommerce Stores
If you need assistance with your store, feel free to contact us at [email protected].
If my assistance was helpful, please consider liking and accepting the solution. Thank you!

View solution in original post

Replies 6 (6)

Robert_Kanaan
Shopify Partner
61 8 18

Hello @Moeez ,

 

You can use CSS to limit the product title to 2 lines.

 

Here's an example:

 

.grid-product__title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  max-height: 3.6em; /* Adjust based on your line height */
}

 

 

To add custom CSS, follow the instructions here:
https://help.shopify.com/en/manual/online-store/themes/theme-structure/extend/add-css#custom-css

 

custom-css.PNG

 

Using this CSS works well for listing pages. However, if you're targeting the Product Details page, this approach may not be ideal. In that case, I recommend adjusting the layout to allow more space for the title or considering shortening the title length for better presentation.

Robert Kanaan | Web Developer @ GoVedia
Building apps & custom solutions
[email protected]
https://govedia.com

devcoders
Shopify Partner
273 43 65

This is an accepted solution.

Hi @Moeez 

- Go to Online Store -> Theme -> Edit code.
- Find the file theme.scss.css and paste the code below at the bottom of the file.

 

.grid-product__title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
}

 



Shopify Developer: Helping eCommerce Stores
If you need assistance with your store, feel free to contact us at [email protected].
If my assistance was helpful, please consider liking and accepting the solution. Thank you!
Robert_Kanaan
Shopify Partner
61 8 18

@devcoders  Modifying the theme's core CSS files is not recommended. This can lead to issues during future theme updates, where changes may be overwritten, making the theme harder to manage. It's best to leave the original theme files untouched. If theme customization is necessary, it's a better practice to add new custom CSS files instead or add cutom CSS within the theme's customization editor.

Robert Kanaan | Web Developer @ GoVedia
Building apps & custom solutions
[email protected]
https://govedia.com
devcoders
Shopify Partner
273 43 65

HI @Robert_Kanaan 

Yes, I understand that modifying the theme's core CSS files is not recommended. However, the store owner doesn't know how to create a custom.css file.

Shopify Developer: Helping eCommerce Stores
If you need assistance with your store, feel free to contact us at [email protected].
If my assistance was helpful, please consider liking and accepting the solution. Thank you!
Moeez
Tourist
5 0 4

Thanks Buddy You Save My Time

 

devcoders
Shopify Partner
273 43 65

Hi @Moeez 

Thank you so much, the solution is working perfectly. If my assistance was helpful, please consider liking and accepting the solution. Thank you!

Shopify Developer: Helping eCommerce Stores
If you need assistance with your store, feel free to contact us at [email protected].
If my assistance was helpful, please consider liking and accepting the solution. Thank you!