html - SVG gets distorted -
i'm trying embed several .svg-files on website. seems work fine long use chrome, firefox or mobile browser i've tested far. however, there's 1 exception: whenever view svg on windows phone (internet explorer mobile) image gets distorted.
i guess found reason behavior already: since want size of svg fluid, gave them percentage-based width , auto-height. works, mentioned before, fine browser. internet-explorer however, seems ignore height:auto thereby stretching svg it's maximum heigth.
that said, 1 solution assign fixed dimensions every single .svg. sacrifice idea of responsive design.
has idea problem might be?
oh, here's link page of website featuring svg (the black "star" saying "select"):
http://alexanderschlosser.de/select.html
many in advance! alex
edit: that's code of 1 of embedded svgs.
<?xml version="1.0" encoding="utf-8"?> <!-- generator: adobe illustrator 16.0.4, svg export plug-in . svg version: 6.00 build 0) --> <!doctype svg public "-//w3c//dtd svg 1.1//en" "http://www.w3.org/graphics/svg/1.1/dtd/svg11.dtd"> <svg version="1.1" id="layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="90px" height="90px" viewbox="0 0 90 90" enable-background="new 0 0 90 90" xml:space="preserve"> <path fill="#e64132" d="m45,87.25c21.703,87.25,2.75,68.297,2.75,45s21.703,2.75,45,2.75s87.25,21.703,87.25,45 s68.297,87.25,45,87.25"/> <path fill="#ffffff" d="m45,5.5c21.78,0,39.5,17.72,39.5,39.5c0,21.78-17.72,39.5-39.5,39.5c23.22,84.5,5.5,66.78,5.5,45 c5.5,23.22,23.22,5.5,45,5.5 m45,0c20.147,0,0,20.147,0,45c0,24.853,20.147,45,45,45c24.853,0,45-20.147,45-45 c90,20.147,69.853,0,45,0"/> <path fill="none" stroke="#ffffff" stroke-width="5.5" stroke-miterlimit="10" d="m67.08,45c0,0-7.193-13.292-22.08-13.292 s22.92,45,22.92,45s30.113,58.292,45,58.292s67.08,45,67.08,45z"/> <path fill="#ffffff" d="m50.433,45c0-3-2.433-5.433-5.433-5.433c-3,0-5.432,2.433-5.432,5.433s42,50.433,45,50.433 c48,50.433,50.433,48,50.433,45"/> </svg>
if want have responsive svg's add new attribute svg tag:
preserveaspectratio="xminymin meet"
<----- take notice of capitalization
you dont need width , height attributes anymore, should responsively conform size of container in (though might need define size of container because chrome render white space below svg if not defined).
edit: defining width , height of svg in css works too
here's fiddle
Comments
Post a Comment