Home > Web Front-end > CSS Tutorial > Why do SVG Image Proportions Skew in IE9\'s `` Element?

Why do SVG Image Proportions Skew in IE9\'s `` Element?

Mary-Kate Olsen
Release: 2024-10-27 02:52:02
Original
498 people have browsed it

Why do SVG Image Proportions Skew in IE9's `` Element?

IE9 Skews SVG Image Proportions in Element

When using CSS to set the maximum height of an SVG image within an element, it is expected that the image will scale proportionately to that height. However, in IE9, certain SVG images may exhibit distorted proportions.

Specifically, the issue arises with SVGs composed of polygons rather than paths. An example of an affected image is the "crocs" SVG from Radiant Interactive: http://www.radiantinteractive.com/rs/images/allies/other/crocs.svg

To address this inconsistency across browsers, it is recommended to always define a viewBox for SVG images, while omitting the width and height attributes from the element. This approach ensures consistent scaling across browsers.

To demonstrate the impact of different SVG attributes, a test page has been created:

[Test Page Link]

By comparing the results in different browsers, one can observe significant variations in image handling based on the combination of SVG attributes and CSS dimensions.

The above is the detailed content of Why do SVG Image Proportions Skew in IE9\'s `` Element?. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template