To show a child element only when hovering over its parent container in Webflow, use interactions and opacity/visibility settings. Here's how to set it up properly.
1. Structure Your Elements
- Wrap the elements in a parent container (e.g.,
div.block-parent
). - Place the child element you want to show on hover inside the parent container (e.g.,
div.block-child
).
2. Set Initial Styles
- Select the child element.
- Set Display: Block or Flex (so it's part of the layout).
- Set Opacity: 0% in the Style panel.
- Optionally set Pointer Events: None under the Advanced section (to prevent unintentional interactions when it's hidden).
3. Create the Hover Interaction
- Select the parent container.
- Go to the Interactions panel (lightning bolt icon).
- Click + next to Element Trigger, then choose Mouse Hover.
- Under On Hover, choose Start an Animation, then click + New Animation.
4. Add Child Element Animation on Hover In
- In the animation timeline, click + Add Action > Select the child element from the Navigator.
- Choose Opacity, and set it to 100%.
- Optionally add easing or duration (e.g., 200ms ease).
5. Add Hover Out Animation
- Back in the hover trigger panel, go to On Hover Out, and create another animation.
- Set the child element opacity back to 0% with the same transition settings.
6. Preview and Fine-Tune
- Preview the interaction in the Designer.
- Adjust the animation timing and child element visibility behavior as needed (e.g., use Display: None and Display: Block if needed, but be careful with layout shifts).
Summary
To display a child element on hover in Webflow, place it inside a parent container, set its initial opacity to 0%, and create a hover interaction on the parent that fades the child in and out.