0

I'm trying to scale an SVG according to user's viewport width

I have this css:

.thesvg {

padding: 0;
line-height: 0;
margin: 0;
width: 50%;
max-width: 360px;

}

It scales as it should horizontally, and the aspect is kept

But it adds whitespace/padding to the top/bottom (and maintains original element height) instead of scaling down entirely

But only in some browsers.. or I think so (maybe because of different viewport sizes)

Is this a bug? Or how can I fix this and achieve a perfectly fluid SVG just by managing the width (if possible)?

mowgli
  • 2,796
  • 3
  • 31
  • 68

0 Answers0