Home > Web Front-end > CSS Tutorial > Why Aren't My SVG Symbols Scaling Correctly in Internet Explorer?

Why Aren't My SVG Symbols Scaling Correctly in Internet Explorer?

Patricia Arquette
Release: 2024-12-15 15:49:17
Original
685 people have browsed it

Why Aren't My SVG Symbols Scaling Correctly in Internet Explorer?

SVG symbols not scaling properly in IE: Additional space

Internet Explorer has a longstanding bug where it improperly scales SVGs without both width and height attributes.

Solution

A solution exists using a trick involving a element, which IE properly scales. Placing a with the same aspect ratio as the SVG within the containing <div> ensures the correct SVG size.

<div>
Copy after login

CSS

canvas {
  display: block;
  width: 100%;
  visibility: hidden;
}

svg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
}
Copy after login

The above is the detailed content of Why Aren't My SVG Symbols Scaling Correctly in Internet Explorer?. 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