Why is text cutting off in SVG Text on Chrome? - html

I have a Logo for my new website.
The logo looks great in Firefox but as you can see the S on Tomorrow's is cut off in Chrome. Why is this?
http://jsfiddle.net/pro5Lgfx/
body {
background:black
}
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg width="195px" height="53px" viewBox="0 0 195 53" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
<title>Logo</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Your-Score" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
<g id="Desktop-Your-Score" sketch:type="MSLayerGroup" transform="translate(-23.000000, -24.000000)" font-weight="normal" font-family="Gill Sans" letter-spacing="1.16666663" font-size="28" sketch:alignment="middle" fill="#FFFFFF">
<g id="Header" sketch:type="MSTextLayer">
<g id="Primary-Nav-[home]-Copy">
<g id="Logo" transform="translate(23.000000, 18.000000)">
<text id="TOMORROW’S">
<tspan x="0.0328778028" y="26">TOMORROW’S</tspan>
<tspan x="36.2975262" y="58">SCORE</tspan>
</text>
</g>
</g>
</g>
</g>
</g>
</svg>

DEMO
I'm no expert in SVG but After Researching a bit ViewBox is
viewBox as the "real" coordinate system, it is the coordinate system
used to draw the SVG graphics onto the canvas Yo can specify
coordinate to viewbox attribute
Source MDN ViewBox Source ViewBox
what i came up when i set viewbox width and height to 100% 100% S was visible in chrome as well
Update
well percentage is supported in viewport(i.e width and height) but not in viewbox,better not put viewbox and viewport unless needed (viewport: width=100% and height=100% will not harm the output)
New DEMO
Example
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
body {
background: black
}
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<svg version="1.1" preserveAspectRatio="xMinYMin meet" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sketch="http://www.bohemiancoding.com/sketch/ns">
<title>Logo</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Your-Score" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" sketch:type="MSPage">
<g id="Desktop-Your-Score" sketch:type="MSLayerGroup" transform="translate(-23.000000, -24.000000)" font-weight="normal" font-family="Gill Sans" letter-spacing="1.16666663" font-size="28" sketch:alignment="middle" fill="#FFFFFF">
<g id="Header" sketch:type="MSTextLayer">
<g id="Primary-Nav-[home]-Copy">
<g id="Logo" transform="translate(23.000000, 18.000000)">
<text id="TOMORROW’S">
<tspan x="0.0328778028" y="27">TOMORROW’S</tspan>
<tspan x="36.2975262" y="58">SCORE</tspan>
</text>
</g>
</g>
</g>
</g>
</g>
</svg>

Related

SVG logo not displaying correctly on mobile

I've created the following SVG:
It is being correctly displayed on desktop, but the problem is on mobile. Here is a screenshot of how it is being displayed:
Here is the SVG:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 210.42 49.75">
<defs>
<style>
.cls-1,.cls-3{font-size:48px;font-family:SHOOTING;}
.cls-2{letter-spacing:-0.02em;}
.cls-3{fill:#ffb857;}
.cls-4{fill:#ff8f00;letter-spacing:0em;}
</style>
</defs>
<title>logo</title>
<g id="Capa_4" data-name="Capa 4">
<text class="cls-1" transform="translate(41 41.79)">BUS<tspan class="cls-2" x="52.37" y="0">C</tspan><tspan x="68.78" y="0">AMINAS</tspan></text>
</g>
<g id="Capa_3" data-name="Capa 3">
<text class="cls-3" transform="translate(42.76 40.32)">BUS<tspan class="cls-2" x="52.37" y="0">C</tspan><tspan x="68.78" y="0">A</tspan><tspan class="cls-4" x="87.17" y="0">MINAS</tspan></text>
<path d="M34.69,19.49a1.27,1.27,0,0,0-.7-.72,1.29,1.29,0,0,0-1,0,11.93,11.93,0,0,0-4,2.63,12.08,12.08,0,0,0-2.63,4,1.29,1.29,0,0,0,0,1,1.26,1.26,0,0,0,.73.7,1.34,1.34,0,0,0,.49.1,1.28,1.28,0,0,0,1.25-.83,9.17,9.17,0,0,1,2-3.07,9.06,9.06,0,0,1,3.08-2,1.39,1.39,0,0,0,.72-.73A1.29,1.29,0,0,0,34.69,19.49Zm19.53-7.37,1,1-5.06,5,1.41,1.4a1.29,1.29,0,0,1,.4.95,1.26,1.26,0,0,1-.4.94L50.2,22.73a14.61,14.61,0,0,1,.69,12.78,14.32,14.32,0,0,1-7.77,7.77,14.55,14.55,0,0,1-11.34,0,14.69,14.69,0,0,1-4.66-3.11,14.75,14.75,0,0,1-4.26-10.33A14.26,14.26,0,0,1,24,24.17a14.58,14.58,0,0,1,20.55-7.08l1.32-1.33a1.31,1.31,0,0,1,.95-.39,1.29,1.29,0,0,1,.94.39l1.41,1.41ZM54.38,11a.63.63,0,0,1-.45.21.66.66,0,0,1-.48-.21L51.56,9.09a.72.72,0,0,1-.18-.48.67.67,0,0,1,1.14-.47L54.38,10a.61.61,0,0,1,.21.47A.59.59,0,0,1,54.38,11Zm4.77,4.77a.69.69,0,0,1-.95,0l-1.87-1.88a.63.63,0,0,1,0-.94.6.6,0,0,1,.47-.2.58.58,0,0,1,.46.2l1.89,1.87a.69.69,0,0,1,0,1Zm.85-3.8a.62.62,0,0,1-.19.48.65.65,0,0,1-.47.19h-2a.65.65,0,0,1-.67-.67.65.65,0,0,1,.19-.47.62.62,0,0,1,.48-.19h2a.65.65,0,0,1,.66.66ZM56,8v2a.66.66,0,1,1-1.32,0V8A.66.66,0,1,1,56,8Zm3.13,1.14L57.26,11a.61.61,0,0,1-.45.21.66.66,0,0,1-.48-.21.59.59,0,0,1-.21-.46.61.61,0,0,1,.21-.47L58.2,8.14A.64.64,0,0,1,58.67,8a.65.65,0,0,1,.67.66A.73.73,0,0,1,59.15,9.09Z" transform="translate(-22.86 -1.21)"/>
</g>
</svg>
Here is the HTML where I have the SVG:
<div class="logo"><img src="./source/logo.svg" alt="Buscaminas" width="255px"></div>
Here is the CSS for the div:
.logo {
height: 50px;
width: 255px;
margin: 10px auto 19px;
}
How can I fix this problem?
I've removed the x and y attributes of the <tspan> elements. This is fixing the problem with the crammed text. However since you are using a special font-family that is not disponible, the font-family is different and the text is wider. In order to get all the text inside the svg canvas I had to change the value of the viewBox. Probably a good idea would be using an alternative font-family, for example Arial.
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 360 60">
<defs>
<style>
.cls-1,.cls-3{font-size:48px;font-family:SHOOTING, Arial;}
.cls-2{letter-spacing:-0.02em;}
.cls-3{fill:#ffb857;}
.cls-4{fill:#ff8f00;letter-spacing:0em;}
</style>
</defs>
<title>logo</title>
<g id="wrapper">
<g id="Capa_4" data-name="Capa 4">
<text class="cls-1" x="41" y="41.79">BUS<tspan class="cls-2" >C</tspan><tspan>AMINAS</tspan></text>
</g>
<g id="Capa_3" data-name="Capa 3">
<text class="cls-3" x="42.76" y="40.32">BUS<tspan class="cls-2" >C</tspan><tspan>A</tspan><tspan class="cls-4">MINAS</tspan></text>
<path id="b" d="M34.69,19.49a1.27,1.27,0,0,0-.7-.72,1.29,1.29,0,0,0-1,0,11.93,11.93,0,0,0-4,2.63,12.08,12.08,0,0,0-2.63,4,1.29,1.29,0,0,0,0,1,1.26,1.26,0,0,0,.73.7,1.34,1.34,0,0,0,.49.1,1.28,1.28,0,0,0,1.25-.83,9.17,9.17,0,0,1,2-3.07,9.06,9.06,0,0,1,3.08-2,1.39,1.39,0,0,0,.72-.73A1.29,1.29,0,0,0,34.69,19.49Zm19.53-7.37,1,1-5.06,5,1.41,1.4a1.29,1.29,0,0,1,.4.95,1.26,1.26,0,0,1-.4.94L50.2,22.73a14.61,14.61,0,0,1,.69,12.78,14.32,14.32,0,0,1-7.77,7.77,14.55,14.55,0,0,1-11.34,0,14.69,14.69,0,0,1-4.66-3.11,14.75,14.75,0,0,1-4.26-10.33A14.26,14.26,0,0,1,24,24.17a14.58,14.58,0,0,1,20.55-7.08l1.32-1.33a1.31,1.31,0,0,1,.95-.39,1.29,1.29,0,0,1,.94.39l1.41,1.41ZM54.38,11a.63.63,0,0,1-.45.21.66.66,0,0,1-.48-.21L51.56,9.09a.72.72,0,0,1-.18-.48.67.67,0,0,1,1.14-.47L54.38,10a.61.61,0,0,1,.21.47A.59.59,0,0,1,54.38,11Zm4.77,4.77a.69.69,0,0,1-.95,0l-1.87-1.88a.63.63,0,0,1,0-.94.6.6,0,0,1,.47-.2.58.58,0,0,1,.46.2l1.89,1.87a.69.69,0,0,1,0,1Zm.85-3.8a.62.62,0,0,1-.19.48.65.65,0,0,1-.47.19h-2a.65.65,0,0,1-.67-.67.65.65,0,0,1,.19-.47.62.62,0,0,1,.48-.19h2a.65.65,0,0,1,.66.66ZM56,8v2a.66.66,0,1,1-1.32,0V8A.66.66,0,1,1,56,8Zm3.13,1.14L57.26,11a.61.61,0,0,1-.45.21.66.66,0,0,1-.48-.21.59.59,0,0,1-.21-.46.61.61,0,0,1,.21-.47L58.2,8.14A.64.64,0,0,1,58.67,8a.65.65,0,0,1,.67.66A.73.73,0,0,1,59.15,9.09Z" transform="translate(-22.86 -1.21)"/>
</g>
</g>
</svg>
UPDATE
In order to control the length of the text you can use the textLength and lengthAdjust attributes like so:
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 245 55">
<defs>
<style>
.cls-1,.cls-3{font-size:48px;font-family:SHOOTING,Arial;}
.cls-2{letter-spacing:-0.02em;}
.cls-3{fill:#ffb857;}
.cls-4{fill:#ff8f00;letter-spacing:0em;}
</style>
</defs>
<title>logo</title>
<g id="Capa_4" data-name="Capa 4">
<text class="cls-1" x="41" y="41.79" textLength="200" lengthAdjust="spacingAndGlyphs">BUS<tspan class="cls-2" >C</tspan><tspan>AMINAS</tspan></text>
</g>
<g id="Capa_3" data-name="Capa 3">
<text textLength="200" lengthAdjust="spacingAndGlyphs" class="cls-3" x="42.76" y="40.32">BUS<tspan class="cls-2" >C</tspan><tspan>A</tspan><tspan class="cls-4">MINAS</tspan></text>
<path id="b" d="M34.69,19.49a1.27,1.27,0,0,0-.7-.72,1.29,1.29,0,0,0-1,0,11.93,11.93,0,0,0-4,2.63,12.08,12.08,0,0,0-2.63,4,1.29,1.29,0,0,0,0,1,1.26,1.26,0,0,0,.73.7,1.34,1.34,0,0,0,.49.1,1.28,1.28,0,0,0,1.25-.83,9.17,9.17,0,0,1,2-3.07,9.06,9.06,0,0,1,3.08-2,1.39,1.39,0,0,0,.72-.73A1.29,1.29,0,0,0,34.69,19.49Zm19.53-7.37,1,1-5.06,5,1.41,1.4a1.29,1.29,0,0,1,.4.95,1.26,1.26,0,0,1-.4.94L50.2,22.73a14.61,14.61,0,0,1,.69,12.78,14.32,14.32,0,0,1-7.77,7.77,14.55,14.55,0,0,1-11.34,0,14.69,14.69,0,0,1-4.66-3.11,14.75,14.75,0,0,1-4.26-10.33A14.26,14.26,0,0,1,24,24.17a14.58,14.58,0,0,1,20.55-7.08l1.32-1.33a1.31,1.31,0,0,1,.95-.39,1.29,1.29,0,0,1,.94.39l1.41,1.41ZM54.38,11a.63.63,0,0,1-.45.21.66.66,0,0,1-.48-.21L51.56,9.09a.72.72,0,0,1-.18-.48.67.67,0,0,1,1.14-.47L54.38,10a.61.61,0,0,1,.21.47A.59.59,0,0,1,54.38,11Zm4.77,4.77a.69.69,0,0,1-.95,0l-1.87-1.88a.63.63,0,0,1,0-.94.6.6,0,0,1,.47-.2.58.58,0,0,1,.46.2l1.89,1.87a.69.69,0,0,1,0,1Zm.85-3.8a.62.62,0,0,1-.19.48.65.65,0,0,1-.47.19h-2a.65.65,0,0,1-.67-.67.65.65,0,0,1,.19-.47.62.62,0,0,1,.48-.19h2a.65.65,0,0,1,.66.66ZM56,8v2a.66.66,0,1,1-1.32,0V8A.66.66,0,1,1,56,8Zm3.13,1.14L57.26,11a.61.61,0,0,1-.45.21.66.66,0,0,1-.48-.21.59.59,0,0,1-.21-.46.61.61,0,0,1,.21-.47L58.2,8.14A.64.64,0,0,1,58.67,8a.65.65,0,0,1,.67.66A.73.73,0,0,1,59.15,9.09Z" transform="translate(-22.86 -1.21)"/>
</g>
</svg>

Safari VoiceOver SVG announces tags inside `<svg />` as separate images

I have an <svg /> element and when I navigate to it in Safari using VoiceOver, the VO announces 6 different images instead of one. Chrome works fine and this element gets announces as an "Unlabelled image":
<svg aria-labelledby="imageLabel-10" class="foo" viewBox="0 -60 577 586">
<title id="sometitle-10"></title>
<defs>
<polygon id="someid" points="1 2 3">
</polygon>
<path d="M.123" id="someOtherId">
</path>
<mask fill="white" id="oneMoreId">
<use xlink:href="#someHred">
</use>
</mask>
</defs>
<g fill="none" fill-rule="evenodd">
<g style="transform: translateY(-22.0061px); transform-origin: 396.328px 301.186px;">
<path d="M225" fill="#F75647" fill-rule="nonzero" transform="translate(0, 0)">
</path>
</g>
<g mask="url(#someHref)">
<image height="461" transform="scale(1.1)" width="693" x="60" xlink:href="//cuteCDNPath.jpg" y="-10" style="transform: scale(1.05339); transform-origin: 286.5px 220.5px;">
</image>
<use fill="#000" fill-opacity="0.01" xlink:href="#someOtherHref" style="mix-blend-mode: multiply;">
</use>
</g>
</g>
</svg>
macOS Mojave 10.14.6
Safari 13.0.5
According to Deque (specifically strategy #5), <svg> tags require a role attribute to be set to img. I am not 100% sure this is the right solution, but adding role="img" did fix my problem.
<svg
aria-labelledby="imageLabel-10"
class="..."
role="img" <!-- this was the missing attribute -->
viewBox="..."
>
...
</svg>

Resize svg image

I recently downloaded a linkedin svg image (website: https://www.flaticon.com/free-icon/linkedin_185964?term=linkedin%20logo&page=1&position=15) i have tried endlessly to resize to fit a 16x16 pixel but i can't make it work. I even tried multiple resources online but no success. This is the code:
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<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"
viewBox="0 0 512.002 512.002" style="enable-background:new 0 0 512.002 512.002;" xml:space="preserve">
<circle style="fill:#4376B1;" cx="256.001" cy="256" r="256"/>
<path style="fill:#336699;" d="M511.016,233.634L394.729,117.198c-71.035,9.237-145.27,7.859-216.305,9.511
c-29.306,0-58.613,13.791-53.441,46.545c10.343,65.508,15.515,129.293,3.448,196.525c-1.9,8.545-5.897,17.089-11.117,25.059
L233.48,511.005c7.421,0.646,14.929,0.996,22.519,0.996c141.384,0,256-114.616,256-256
C512.001,248.461,511.656,241.005,511.016,233.634z"/>
<path style="fill:#FFFFFF;" d="M376.023,109.468H135.979c-14.643,0-26.51,11.867-26.51,26.51V376.02
c0,14.639,11.867,26.51,26.51,26.51h240.042c14.639,0,26.51-11.871,26.51-26.51V135.978
C402.533,121.335,390.662,109.468,376.023,109.468L376.023,109.468z M200.155,362.517c0,4.263-3.453,7.716-7.716,7.716h-32.837
c-4.263,0-7.716-3.455-7.716-7.716V224.856c0-4.263,3.455-7.716,7.716-7.716h32.839c4.263,0,7.716,3.455,7.716,7.716v137.661
H200.155z M176.02,204.162c-17.23,0-31.196-13.969-31.196-31.201c0-17.229,13.965-31.196,31.196-31.196
c17.232,0,31.198,13.969,31.198,31.196C207.218,190.195,193.251,204.162,176.02,204.162L176.02,204.162z M371.773,363.139
c0,3.918-3.175,7.096-7.09,7.096h-35.242c-3.915,0-7.092-3.177-7.092-7.096v-64.574c0-9.63,2.826-42.21-25.172-42.21
c-21.719,0-26.124,22.3-27.008,32.304v74.478c0,3.918-3.175,7.096-7.094,7.096h-34.082c-3.918,0-7.096-3.177-7.096-7.096V224.234
c0-3.918,3.177-7.096,7.096-7.096h34.082c3.918,0,7.094,3.177,7.094,7.096v12.009c8.054-12.085,20.023-21.416,45.502-21.416
c56.425,0,56.105,52.717,56.105,81.686v66.627H371.773z"/>
<path style="fill:#D1D1D1;" d="M376.023,109.468H255.427v107.67h7.647c3.918,0,7.094,3.177,7.094,7.096v12.009
c8.054-12.085,20.023-21.416,45.503-21.416c56.425,0,56.105,52.717,56.105,81.686v66.625c0,3.918-3.175,7.096-7.09,7.096h-35.242
c-3.915,0-7.092-3.177-7.092-7.096v-64.574c0-9.63,2.826-42.21-25.172-42.21c-21.719,0-26.124,22.3-27.008,32.304v74.478
c0,3.918-3.175,7.096-7.094,7.096h-7.647v32.301h120.596c14.639,0,26.51-11.871,26.51-26.51V135.978
C402.533,121.335,390.662,109.468,376.023,109.468z"/>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>
As suggested by Robert Longson in the comments - you can set the width and height attributes of the SVG node and you will achieve the desired result.
<?xml version="1.0" encoding="iso-8859-1"?>
<!-- Generator: Adobe Illustrator 19.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<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="16" height="16"
viewBox="0 0 512.002 512.002" style="enable-background:new 0 0 512.002 512.002;" xml:space="preserve">
<circle style="fill:#4376B1;" cx="256.001" cy="256" r="256"/>
<path style="fill:#336699;" d="M511.016,233.634L394.729,117.198c-71.035,9.237-145.27,7.859-216.305,9.511
c-29.306,0-58.613,13.791-53.441,46.545c10.343,65.508,15.515,129.293,3.448,196.525c-1.9,8.545-5.897,17.089-11.117,25.059
L233.48,511.005c7.421,0.646,14.929,0.996,22.519,0.996c141.384,0,256-114.616,256-256
C512.001,248.461,511.656,241.005,511.016,233.634z"/>
<path style="fill:#FFFFFF;" d="M376.023,109.468H135.979c-14.643,0-26.51,11.867-26.51,26.51V376.02
c0,14.639,11.867,26.51,26.51,26.51h240.042c14.639,0,26.51-11.871,26.51-26.51V135.978
C402.533,121.335,390.662,109.468,376.023,109.468L376.023,109.468z M200.155,362.517c0,4.263-3.453,7.716-7.716,7.716h-32.837
c-4.263,0-7.716-3.455-7.716-7.716V224.856c0-4.263,3.455-7.716,7.716-7.716h32.839c4.263,0,7.716,3.455,7.716,7.716v137.661
H200.155z M176.02,204.162c-17.23,0-31.196-13.969-31.196-31.201c0-17.229,13.965-31.196,31.196-31.196
c17.232,0,31.198,13.969,31.198,31.196C207.218,190.195,193.251,204.162,176.02,204.162L176.02,204.162z M371.773,363.139
c0,3.918-3.175,7.096-7.09,7.096h-35.242c-3.915,0-7.092-3.177-7.092-7.096v-64.574c0-9.63,2.826-42.21-25.172-42.21
c-21.719,0-26.124,22.3-27.008,32.304v74.478c0,3.918-3.175,7.096-7.094,7.096h-34.082c-3.918,0-7.096-3.177-7.096-7.096V224.234
c0-3.918,3.177-7.096,7.096-7.096h34.082c3.918,0,7.094,3.177,7.094,7.096v12.009c8.054-12.085,20.023-21.416,45.502-21.416
c56.425,0,56.105,52.717,56.105,81.686v66.627H371.773z"/>
<path style="fill:#D1D1D1;" d="M376.023,109.468H255.427v107.67h7.647c3.918,0,7.094,3.177,7.094,7.096v12.009
c8.054-12.085,20.023-21.416,45.503-21.416c56.425,0,56.105,52.717,56.105,81.686v66.625c0,3.918-3.175,7.096-7.09,7.096h-35.242
c-3.915,0-7.092-3.177-7.092-7.096v-64.574c0-9.63,2.826-42.21-25.172-42.21c-21.719,0-26.124,22.3-27.008,32.304v74.478
c0,3.918-3.175,7.096-7.094,7.096h-7.647v32.301h120.596c14.639,0,26.51-11.871,26.51-26.51V135.978
C402.533,121.335,390.662,109.468,376.023,109.468z"/>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
<g>
</g>
</svg>
<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="16px" height="16px">.....</svg>
set fixed width and height for svg tag...

How to edit text in a SVG file? (not programmatically)

I'm trying to edit a .svg file i found in a website template i recently downloaded.
The file code is this one:
<?xml version="1.0" encoding="UTF-8"?>
<svg width="52px" height="10px" viewBox="0 0 52 10" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Stacked</title>
<desc>Created with Sketch.</desc>
<defs></defs>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" font-size="12" font-family="ProximaNova-Bold, Proxima Nova" font-weight="bold">
<text id="Stacked" fill="#000000">
<tspan x="0" y="9">Stacked</tspan>
</text>
</g>
</svg>
What i want is to simply change the text. I was expecting to do it by changing the inner text of the TSPAN tag you can see at the end of the file. But nothing happens, even if I change text from a SVG editor.
So, my question is: what is the proper way to achieve my goal? Is it even possible to change text in a SVG file?
This is your code, and it should work (please run the code):
svg{border:1px solid;overflow:visible}
<svg width="52px" height="10px" viewBox="0 0 52 10" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
<title>Stacked</title>
<desc>Created with Sketch.</desc>
<g id="Page-1" stroke="none" stroke-width="1" fill="none" fill-rule="evenodd" font-size="12" font-family="ProximaNova-Bold, Proxima Nova" font-weight="bold">
<text id="Stacked" fill="#000000">
<tspan x="0" y="9">Stacked edited</tspan>
</text>
</g>
</svg>
As an observation: the SVG canvas is very small so large part of the text is not visible unless you add overflow:visiblefor the svg.

SVG Horizontal Dashed Circle

I'm trying to create the following as an SVG:
I.e. a circle with dashed horizontal lines.
This is the SVG code I have at the moment...generated by Adobe Illustrator:
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 16.0.0, 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="165px" height="165px" viewBox="0 0 165 165" enable-background="new 0 0 165 165" xml:space="preserve">
<g>
<circle fill="none" stroke="#000000" stroke-width="9" stroke-miterlimit="23" stroke-dasharray="1.0048,6.0288" cx="82.453" cy="82.563" r="75"/>
</g>
</svg>
But when I open in Chrome the lines seem to be very jagged and some lines are closer then others.
Is there a better way to produce this SVG or shall I simply use a PNG?
Here's a different approach to produce the same appearance which should be more stable across renderers, by using actual line segments rather than very short stroke dashes.
I've used <defs> and <use> to keep the repetition sane — I define four axis-aligned lines around a center and then rotate it by a quarter-circle of even steps. (I changed the scale a bit for the sake of round numbers in my example.)
Note that if zoomed in it will be slightly different: in the original, each dash will be slightly wedge-shaped (due to the curve of the circle), whereas here they will have a constant width since they are just plain line segments.
<svg width="160px" height="160px" viewBox="0 0 160 160">
<defs>
<g id="lines" style="stroke: black;">
<line x1=" 71" x2=" 79" />
<line x1="-71" x2="-79" />
<line y1=" 71" y2=" 79" />
<line y1="-71" y2="-79" />
</g>
</defs>
<g transform="translate(80 80)">
<use xlink:href="#lines" transform="rotate( 0)"/>
<use xlink:href="#lines" transform="rotate( 5)"/>
<use xlink:href="#lines" transform="rotate(10)"/>
<use xlink:href="#lines" transform="rotate(15)"/>
<use xlink:href="#lines" transform="rotate(20)"/>
<use xlink:href="#lines" transform="rotate(25)"/>
<use xlink:href="#lines" transform="rotate(30)"/>
<use xlink:href="#lines" transform="rotate(35)"/>
<use xlink:href="#lines" transform="rotate(40)"/>
<use xlink:href="#lines" transform="rotate(45)"/>
<use xlink:href="#lines" transform="rotate(50)"/>
<use xlink:href="#lines" transform="rotate(55)"/>
<use xlink:href="#lines" transform="rotate(60)"/>
<use xlink:href="#lines" transform="rotate(65)"/>
<use xlink:href="#lines" transform="rotate(70)"/>
<use xlink:href="#lines" transform="rotate(75)"/>
<use xlink:href="#lines" transform="rotate(80)"/>
<use xlink:href="#lines" transform="rotate(85)"/>
</g>
</svg>
This is a SVG-in-HTML fragment — if using it as a standalone SVG document don't forget to put the xmlns back in.
Here is an alternative approach with the same tick count and tick size.
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="165px" height="165px" viewBox="0 0 165 165">
<g transform="translate(82.453 82.563)">
<g id="t32">
<g id="t16">
<g id="t8">
<g id="t4">
<g id="t3">
<rect x="70.5" y="-0.5024" width="9" height="1.0048" id="t"/>
<use xlink:href="#t" transform="rotate(5.37)"/>
<use xlink:href="#t" transform="rotate(10.75)"/>
</g>
<use xlink:href="#t" transform="rotate(16.12)"/>
</g>
<use xlink:href="#t4" transform="rotate(21.49)"/>
</g>
<use xlink:href="#t8" transform="rotate(42.99)"/>
</g>
<use xlink:href="#t16" transform="rotate(85.97)"/>
</g>
<use xlink:href="#t32" transform="rotate(171.94)"/>
<use xlink:href="#t3" transform="rotate(343.88)"/>
</g>
</svg>