Hello, i want to add heading over the text in collection list cards.
I already found a part of the solution which is this snippet code:
.card__content {
position: absolute;
bottom: 1px;
left: 15px;
overflow: hidden;
transition: all 0.5s ease;
}
The problem here is that it works on both collection list card and on product recommendation collection.
I would like to only target collection list cards without affecting anything else on the page so the text on products stay under the image. I’m pretty bad with css, i can’t find any solution to that. Anyone could help me with that please?
1 Like
Hi @Drakhtul
Would you mind to share your store URL? Thanks!
Hi @Drakhtul ,
The code you added is correct, but with your requirement, you want only display like that in collections, you must add a condition so that this CSS will only work on page collections.
=>>
{% if template == 'collection' or template == 'list-collections' %}
<style>
.card__content {
position: absolute;
bottom: 1px;
left: 15px;
overflow: hidden;
transition: all 0.5s ease;
}
</style>
{% endif %}
The result is only collection list cards without affecting anything else on the page so the text on products stay under the image.
Hope it helps @Drakhtul
1 Like
Hmm. I think i did everything correctly. I went to base.css and removed all code regarding .card__content and then i went to the theme.liquid and pasted your code but nothing has changed. Am i doing something wrong?
Beside that when i click collection Your code messing up the content. Without the code its all good, with it the text it’s on the image.
I found solution with this code
.collection-list__item .card .card__heading {
position: absolute;
bottom: 12.5%;
left: 7.5%;
}
The title is on the bottom left like i want but the problem is that image is not longer clickable, only the title text is the link to the collection and i would like to whole image be clickable.
Same situation with this
.collection-list__item .card__content {
position: absolute;
text-align: start;
bottom: 0;
}
I actually fixed that by myself. Thanks everyone for looking for solution and trying to help me. Please close the thread.
Hello Drakhtul,
I saw you fixed your issue. Could you share what you did to make the whole card clickable again? Thanks