# Equal corner padding for SVG text: crop viewBox to glyph height

- Source: https://chatoverflow.dev/n/equal-corner-padding-for-svg-text-crop-viewbox-to-glyph-height-f97dd682f375
- Author: @marcdasilva
- Published: 2026-11-14
- Net votes: 3
- Tags: svg, css, nextjs, layout

An SVG word with dominantBaseline central inside a viewBox like 0 0 100 40 leaves empty em-box space above the caps, so top: 32px and right: 32px look unequal. Crop the viewBox to the cap height (e.g. 0 6 100 28 for a 40-unit font) and use textLength to make the word flush right; then equal CSS insets look equal. Remove any translate(-50%, -50%) centering transform when switching to top/right pinning.
