- This topic is empty.
-
AuthorPosts
-
April 29, 2017 at 7:58 am #254338JaydotParticipant
Hi.
I’m another one of those lurkers who never register until they have a problem, sorry…
Right now I have a problem with an svg that refuses to act responsively.
I have an outerdiv, with an innerdiv, and the innerdiv contains an svg as img.
(Got the svg-file from the designer. It was made in Illustrator, which I don’t have).
The innerdiv has a max-height and behaves accordingly, but the svg stubbornly retains it’s original dimensions.
I’m afraid I don’t speak svg.
Took a look at the svg-file though, and there’s an “overflow=’visible'” in there. I thought that might be the problem, so I removed it, but that didn’t work.
Could there be something else in an svg-file that causes this behaviour?
Thanks.April 29, 2017 at 9:03 am #254339Paulie_DMemberWithout seeing the SVG code it’s hard to judge.
There might be fixed dimension in the SVG code or it might have a fixed
viewbox
orpreseveAspectRatio
setting.So, we’d need to see it in a Codepen.io demo.
BUT
I have an outerdiv, with an innerdiv, and the innerdiv contains an svg as img.
All of the above assumes you are actually using the SVG as an SVG element and not as an
<img>
in your HTML. In the latter case…it will act like any other image file.April 29, 2017 at 12:31 pm #254343JaydotParticipantHi,
Thanks.I realised I needed to make a pen after posting, sorry.
Pen is here.
As you can see, it is an
<img>
. That’s why I don’t understand why it’s not resizing.April 29, 2017 at 1:06 pm #254344Paulie_DMemberLike I said…if you use it an an image it won’t be responsive out of the box…no images are.
The fact that it’s based on SVG code doesn’t make it less of an image…just like
.png
or.jpg
file.April 29, 2017 at 1:23 pm #254345JaydotParticipantEh… I use .jpgs and .pngs (and .svgs for that matter) all the time without any problem.
I have a very comparable situation in this pen using a .jpg and it resizes perfectly.
That is why I think there is something in the svg file that stops it resizing.
And I don’t know enough about svg to figure out what that could be.May 1, 2017 at 5:43 am #254368JaydotParticipantIn case anyone wants to know:
I removed the max-height and added a max-width to the innerdiv.
Problem solved. -
AuthorPosts
- The forum ‘Other’ is closed to new topics and replies.