question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

It 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:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
lindellcommented, Jul 5, 2017

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.

0reactions
matt-oconnellcommented, Aug 15, 2017

Perfect, thanks!

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found