Centering a third-party affiliate code widget on a Webflow page involves a few straightforward steps to ensure the widget aligns perfectly in your design.
1. Add the Embed Element
- Drag the Embed element from the components panel into your desired location on the page.
- Paste the affiliate code into the Embed element where the HTML code can be added.
2. Use Flexbox for Centering
- Select the parent container of the Embed element, such as a section or a div block, and ensure it is currently selected.
- In the style panel, set the
Display setting to Flex. - Change the flex direction to
Vertical or Horizontal, depending on your layout needs. - Set Justify and Align: Make both
Justify and Align selections center. This will center the widget horizontally and vertically within the parent element.
3. Adjust Embed Element Size
- Ensure the Embed element is appropriately sized to fit the widget by setting width and height properties if necessary.
- Use percentages or pixels: For responsive design, consider using percentage values to maintain proportions across different devices.
4. Preview and Publish
- Preview the page to make sure the widget is centered as expected.
- Make necessary adjustments in the flex settings or sizes if alignment seems off.
- Publish the changes to your website once everything looks aligned.
Summary
To center a third-party affiliate code widget in Webflow, place the code in an Embed element and use Flexbox on the parent container to align it horizontally and vertically. Adjust the widget’s size and preview changes to ensure correct alignment before publishing.