Reputation: 751
I have an svg
shape and I have some text. I essentially want the shape to have the outline of the text within the shape.
Here is my code:
<g class="monogram">
<mask id="rSquare" x="0" y="0" width="34" height="34">
<text fill="#ffffff" x="0" y="0" font-family="verdana" font-size=
"26">LI</text>
</mask>
<rect mask="url(#rSquare)" height="34" rx="4" ry="4" width="34" fill="#fff"/>
</g>
So, the rect
is essentially a square with a rounded border. So preferably I want the rSquare
to be have a fill
color and the text
to be transparent within the shape creating an outline within it.
How would I go about this? I thought the above example would work, but it hasn't...
Thanks!
Upvotes: 2
Views: 49
Reputation: 123995
You have various issues:
So after all that I get this...
<svg>
<g class="monogram">
<mask id="rSquare" x="0" y="0" width="34" height="34" maskUnits="userSpaceOnUse">
<rect width="34" height="34" fill="white"/>
<text fill="black" x="4" y="26" font-family="verdana" font-size="26">LI</text>
</mask>
<rect mask="url(#rSquare)" height="34" rx="4" ry="4" width="34" fill="blue"/>
</g>
</svg>
Upvotes: 3