Need to add Interaction for Div Container

For example, I have an image and text in my container, which are previews for the main page. If you add an interaction only for an image, then the user can click on the text below it and nothing will happen. You either have to add a link to the text, which increases the work and adds unnecessary internal links, or a “go” button, which is undesirable since it is not intended by design.

Thanks to the developers if you add :slight_smile:

I think there’s something called a stretched-link which you can target the whole Div/bloc etc.
try having a search for that phrase and see what comes up.
Sorry, just on my phone and about to go out….
Best of luck.

1 Like

Thanks for the advice, I’ll try it.

If you don’t want to have a button or text link just use Onclick() as a custom attribute. There are already several topics on the forum on how to apply.

1 Like

Thanks Jerry!

Buttons don’t have to look like buttons. If you have a button with an almost transparent background it can just look like text.

1 Like

Adding the .stretched-link class to any link will expand it to the parent element.

The only thing to watch for is the parent needs to have a position of relative set for stretched link to work. Some elements have this as default like cards. So if it’s not working then that’s likely the cause.

Bootstrap helper classes are handy to learn about.

1 Like

Thank you, you helped. I used the div container for nothing, I needed a card + .stretched-link and everything began to work as it should.

2 Likes