Webflow sync, pageviews & more.
NEW

How can I make the block containing text in Webflow grow to the same height as the text, without it pushing up or down the "hide text" button?

TL;DR
  • Wrap both the text and "hide text" button in the same parent container for layout control.
  • Set the text block's height to Auto so it expands with content.
  • To position the button consistently, use either Absolute positioning (with Relative parent) or a Flex Column layout with Margin Top: Auto on the button.
  • Optionally, add a transition on the text block’s height or use interactions for smooth expand/collapse effects.

Your issue relates to making a text block grow in height with its content while keeping the "hide text" button positioned consistently, likely below or overlapping the text block.

1. Ensure Proper Parent Structure

  • Wrap your text content and the “hide text” button in the same parent container (e.g. a div block).
  • This allows you to control the layout relationship between the text content and the button.

2. Use Auto Height on the Text Block

  • Select the block containing your text.
  • In the Style panel, set Height: Auto. This ensures that the block expands as the text grows or contracts.

3. Set Button Positioning Correctly

To prevent the button from being pushed by changing text height:

  • Option A: Absolute Positioning

  • Select the "hide text" button.

  • Set Position: Absolute.

  • Set the parent container to Position: Relative.

  • Use bottom: 0px (or your desired offset) to pin the button to the bottom of its container, regardless of content height.

  • Option B: Flex Layout (Vertical)

  • Set the parent container to Display: Flex, Direction: Vertical (Column).

  • Place the text block as the first child and the button second.

  • For the button, set Margin Top: Auto to push it to the bottom of the container.

4. Optional: Smooth Transition

If the text block height changes due to toggling (e.g. expand/collapse), add:

  • Transition on Height to the block (Transition: Height in the Style panel).
  • Alternatively, use Webflow Interactions to animate height between custom values or Auto (note: animating to height: auto requires setting min/max height in animations for consistency).

Summary

Set the text block’s height to Auto so it grows with content. Then use Absolute positioning (with a Relative parent) or a Flex layout with Margin Auto to keep the “hide text” button anchored and unaffected by changes in the block height.

Rate this answer

Other Webflow Questions