Add viewbox attribute
See original GitHub issuePlease add viewbox
attribute to the SVG element, and allow to pass it as an optional @Input. Without viewbox
SVGs don’t scale along with their parent container, but remain fixed to their defines width/height.
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
viewBox - SVG: Scalable Vector Graphics - MDN Web Docs
The viewBox attribute defines the position and dimension, in user space, of an SVG viewport. The value of the viewBox attribute is a...
Read more >SVG viewBox Attribute - GeeksforGeeks
The viewBox is an attribute of the SVG element in HTML. It is used to scale the SVG element that means we can...
Read more >SVG Viewport and viewBox (For Complete Beginners)
Control the viewBox by adding the attribute viewBox to the svg element. It can also be used on the elements symbol , marker...
Read more >How can I set a viewBox on an SVG element created with ...
You have to use document.createElementNS("http://www.w3.org/2000/svg", "svg") instead of document.createElement('svg'). document.
Read more >Art-Directing SVG Images With The viewBox Attribute
The viewBox attribute is used to specify the origin and dimensions of the user coordinate system of an SVG image. All the drawing...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
My use case was, that i used an SVG directly from a Wikimedia URL, and that SVG rendered without a viewbox attribute. Not having an intermediary method to include the viewbox, i had to resolve to either download the file first, or apply an attribute on runtime, both of which solution defeat the purpose of having a convenient library to do it, in my opinion.
@AsafAgranat, @bladeski angular-svg-icon@9.1.0 now has a means to set the viewBox. Here’s the documentation from the readme: