The max-width property behaves differently for flex and block elements in Webflow, which is why applying it directly to a form might not work as expected. Forms in Webflow often act as shrink-to-fit inline-block elements, which means they take only as much space as their content requires. Below are steps to ensure your form behaves responsively with the desired max-width.
- Place your form inside a Div Block and set that Div Block's width to 100% and max-width to your desired value (e.g., 600px).
- This helps constrain the form while ensuring it remains responsive.
- Select your Form Block in Webflow.
- Set its Display to Block instead of the default inline-block.
- This ensures the max-width applies correctly.
3. Apply Auto Margins for Centering
- On your Form Block or Wrapper Div, set:
- Width: 100% (to allow responsiveness).
- Max-width: [your desired width] (e.g., 600px).
- Margin-left and Margin-right: Auto (to center the form on larger screens).
4. Ensure Mobile Compatibility with Flexbox/Grid
- If the form still overflows on mobile:
- Use a parent container with flexbox and ensure it does not restrict width unnecessarily.
- Check padding and margins on smaller breakpoints to prevent unnecessary spacing issues.
Summary
Wrap the form inside a Div Block, apply the max-width to the wrapper instead of the form itself, and ensure the form’s display is set to block. Additionally, use auto margins for centering and check for any restrictive styling in smaller breakpoints.