Context:
Tyring to put a SVG path text on top of a circle image.
A square picture is rounded up useing rounded-circle
. A SVG path is drawn around it and use to write a text. Resulting in :
Code: https://jsfiddle.net/ghLn4jkt/
<div class="mt-3 row">
<div class="col-9 CircleThing" style="background-color: coral;">
<img src="https://via.placeholder.com/500/" alt="contact" class="rounded-circle">
<svg width="600" height="600">
<!--Base circle for the text-->
<!--<circle id="curve" cx="270" cy="270" r="260" stroke="black" stroke-width="3" fill="red" />-->
<path id="curve" fill="transparent"
d="M 10, 270
a 260,260 0 1,0 520,0
a 260,260 0 1,0 -520,0 " />
<text width="520">
<textPath xlink:href="#curve" >
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
</textPath>
</text>
</svg>
</div>
</div>
Css:
.CircleThing {
font-family: Gill Sans Extrabold;
font-size: 50px;
}
Issue:
In my last try I have multiple issue:
1/. The svg is not on top of the img.
2/. The text start in the bottom left corner while I want it to in the right.
To create the path I first did a SVG circle and after reading https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/d deduce it path to be :
M cx, cy
a r,r 0 1,0 (r * 2),0
a r,r 0 1,0 -(r * 2),0
3/. The text is upside down or Inside out. for the top right quatter
This is my solution. Please note that I've reversed the
#curve
for thetextPath
. Also I've moved the image inside the SVG and rounded withclipPath
. This is important if you need to make it responsive.