-
YEAR93
Hi,
I’m trying to make a full
.service-cardcontainer clickable on my homepage (3-column grid layout), based on this guide: https://generatepress.com/forums/topic/making-full-div-clickable/The approach works in general, but I’m running into an issue when combining it with an
position: absolute;button inside the card.Current setup:
Each card looks like this structure
– Container (
.service-card)
— Heading<h2>
— Heading<p>
— Button (.card-arrow)Custom CSS used:
.service-card { position: relative; } .card-arrow { position: absolute; right: 44px; bottom: 44px; z-index: 2; } .card-arrow::before { content: ''; position: absolute; inset: 0; z-index: 1; }And for the full-card clickable behavior I’m trying to use the
::beforepseudo-element approach (overlay on the parent container).Problem:
When I apply the full clickable container technique (using
::beforeon.card-arrow), the clickable behavior stops working correctly or becomes inconsistent.It seems the issue happens because the
.card-arrowalso hasposition: absolute;Expected result:
- Entire
.service-cardshould be clickable (like a card link) - The
.card-arrowshould remain positioned bottom-right
Could you help resolve this please?
- Entire
-
Alvind
Hi there,
Try replacing your CSS with this:
.service-card { display: flex; flex-direction: column; position: relative; } .card-arrow { margin-top: auto; align-self: flex-end; } .card-arrow::before { content: ''; position: absolute; inset: 0; z-index: 1; } -
YEAR93
Thank you, I already fixed it using almost similar method you’ve sent me.
-
Alvind
Glad to hear that!
- You must be logged in to reply to this topic.