Is the SVG scaling from the center even though the transformation origin of the DIV holding it is centered?

Published on
September 22, 2023

Yes, the SVG scaling from the center is dependent on the transformation origin of the DIV holding it. By default, the SVG element is scaled from its top left corner. However, if the transformation origin of the DIV is centered, then the SVG will scale from its center point.

To achieve this, you can use CSS to set the transform origin of the DIV to center. Here's how you can do it:

  1. Select the DIV element that contains the SVG in the Webflow Designer.
  2. In the Style panel, go to the Transform section.
  3. Click on the "Advanced" button next to the "Transform" property.
  4. In the "Transform Origin" field, enter "center" or use the sliders to set the horizontal and vertical origin to 50%.
  5. Save and preview your changes.

Now, when you scale the SVG using CSS transformations (e.g., scale, scaleX, scaleY), it will scale from its center, aligned with the center of the DIV.

By aligning the transformation origin of the DIV with its center, you ensure that the SVG scales symmetrically in all directions and maintains its position within the container, resulting in a visually pleasing effect.

Additional Questions

  1. How do I scale an SVG element in Webflow?
  2. Can I change the origin point of an SVG element in Webflow?
  3. What is the default transformation origin for SVG elements in Webflow?