Skip to content

Instantly share code, notes, and snippets.

@TorstenC
Last active April 24, 2025 01:38
Show Gist options
  • Save TorstenC/84954d4a53202300ce4ef556f0265f08 to your computer and use it in GitHub Desktop.
Save TorstenC/84954d4a53202300ce4ef556f0265f08 to your computer and use it in GitHub Desktop.
SVG Symbole, wenn Emojis fehlen

SVG Symbole, wenn Emojis fehlen

Vorgehensweise:

  1. Beginne mit rect x="0" y="0" width="100" height="100" stroke="red"
  2. Positioniere ein M mit font-size="150" in dem Quadrat
  3. Füge 🟨 mit den Koordinaten des M ein (x="50.37" y="99.6" font-size="150"), um die Größe und die Position des Emoji-Bereiches zu ermitteln.
    Die Größe ist width="148" height="148".
  4. Positioniere ein Quadrat der gleichen Größe (x="-23.6" y="-27.25" width="148" height="148"), um den Emoji-Bereich auszufüllen.

Das Ergebnis ist hier z.B. ein B in einem blauen Quadrat:

<svg viewBox="-23.9 -27.2 148.0 148.0" height="1em" xmlns="http://www.w3.org/2000/svg">
  <text x="50.37" y="99.6" font-size="150" text-anchor="middle">🟨</text>
  <rect x="-23.6" y="-27.25" width="148" height="148" rx="25" ry="25" fill="blue"/>
  <text x="50.37" y="99.6" font-size="150" fill="darkgray" text-anchor="middle" font-family="Times">M</text>
  <text x="50" y="107" font-size="170" font-weight="bold" fill="white" text-anchor="middle" font-family="Arial">B</text>
  <rect x="0" y="0" width="100" height="100" stroke="red" stroke-width=".5" fill-opacity="0" />
</svg>

blue_B svg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment