Shopify themes, liquid, logos, and UX
Hello,
I'm trying to style the card heading and I'm facing an issue with the underline width. I want the underline to match the exact width of the text. I'm currently using the Dawn theme (version 15.0.1).
Below is the CSS I'm using (which works perfectly for the most part):
.card__heading a {
font-size: 16px !important;
font-weight: 700 !important;
color: #000 !important;
text-decoration: none !important;
position: relative !important;
display: inline-block !important;
}
.card__heading a:hover {
color: #ff33fd !important;
}
.card__heading a::after {
content: '' !important;
position: absolute !important;
width: 0 !important;
height: 2px !important;
background-color: #ff33fd !important;
bottom: 0px !important;
top: 23px!important;
left: 0 !important;
transition: width 0.3s ease !important;
}
.card__heading a:hover::after {
width: 100% !important;
}
.card-information>* {
-webkit-line-clamp: 1 !important;
-webkit-box-orient: vertical !important;
display: -webkit-box !important;
overflow: hidden !important;
}
The problem arises when I add the following properties to .card__heading a:
-webkit-line-clamp: 1!important;
-webkit-box-orient: vertical!important;
display: -webkit-box!important;
overflow: hidden!important;
line-height: 25px!important;
transition: color 0.3s ease!important;
After adding these lines, I'm unable to make the underline match the length of the product title anymore.
Do you have any suggestions on how to resolve this issue?
Thank you in advance for your time and help.
Best regards,
Adrian
Hello Sangeetanahar,
You are a genius—thank you! The issue is mostly resolved, but I’ve encountered a strange problem. The fix is now working across all collections except for one on the home page.
If you could take a look, I’d be really grateful.
Website: www.vapelounge.uk
Password: vl
When you're on the site, you'll notice that the fix is applied to all .card_heading a { elements, except for the "Mix and Match Disposables" section. Do you have any idea why this might be happening?
Thanks so much for your time and help!
Best regards,
Adrian
Noticed one problem more just now because of my code collection list is not clickable. 😕
I just noticed that the underline is longer than the product title, not only in the "Mix and Match Disposables" collection but also in the CBD and New Arrivals collections. It's strange because the underline is not working correctly on the Disposables and CBD collection pages, while it works fine on the other collection pages.
I'm not sure what's going on or why it works for some collections and not for others. Do you have any suggestions, please?
Hi @adkowaty , kindly provide your store URL please. Thanks
Hi @adkowaty
You can try to update your code to this and check again
.card__heading { display: block; width: fit-content; }
.card__heading a {
font-size: 16px !important;
font-weight: 700 !important;
color: #000 !important;
text-decoration: none !important;
position: relative !important;
display: inline-block !important;
}
.card__heading a:hover {
color: #ff33fd !important;
}
.card__heading a:after {
content: '' !important;
position: absolute !important;
width: 0 !important;
height: 2px !important;
background-color: #ff33fd !important;
bottom: 0px !important;
top: 23px!important;
left: 0 !important;
transition: width 0.3s ease !important;
}
.card__heading a:hover::after {
width: 100% !important;
}
.card-information>* {
-webkit-line-clamp: 1 !important;
-webkit-box-orient: vertical !important;
display: -webkit-box !important;
overflow: hidden !important;
}
- Helpful? Like and Accept solution! Or Support me: Buy Coffees
- Reton: Loyalty & Rewards - Earn points through tasks, redeem for discounts, and enjoy exclusive VIP rewards!
- Ryviu - Reviews & QA app: Collect product reviews, import reviews from AliExpress, Amazon, Etsy, Walmart, Shopee, Dhgate and CSV.
- Lookfy Gallery: Lookbook Image: Easy and fast to create Photo Gallery, Lookbook, Shop The Look.
- Reelfy‑Shoppable Videos+Reels: Create shoppable videos to engage customers and drive more sales.
- Enjoy 1 month of Shopify for $1. Sign up now.
Hi Dan-From-Ryviu,
Thank you for the CSS, but unfortunately, it doesn't work. 😕
Regards,
Adrian
Regards,
Adrian
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