Responsive SVG
See original GitHub issueIt would be nice if you can specify a width=“100%” on the SVG and have it keep it.
At the moment I’m having to do:
JsBarcode(".lp-barcode").init();
document.querySelectorAll('.lp-barcode').forEach(function(element) {
element.setAttribute('width', '100%');
element.removeAttribute('height');
});
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Make SVG Responsive - the new code
For an image format that features infinite scalability, SVG can be a surprisingly difficult format to make responsive: vector images do not ...
Read more >Making SVG responsive - css - Stack Overflow
I have an SVG with the following code. I'd like to make it have a responsive width, and I've read that you shouldn't...
Read more >10 golden rules for responsive SVGs - Creative Bloq
10 golden rules for responsive SVGs · 01. Set up your tools correctly · 02. Remove height and width attributes · 03. Optimise...
Read more >Making SVGs Responsive with CSS - Codrops
In order to make an SVG fluid, the first logical thing to do is to remove the height and width attributes. When a...
Read more >How to Create Responsive SVG Images
How to Create Responsive SVG Images ; 1. Hand Code the SVG Element ; 2. Define Some Symbols ; 3. Define Symbols For...
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
You could just do that with CSS. I don’t think this qualifies as a big enough use case to be included in the library.
Perfect, thanks!