I am faced with a specific challenge where I need to center the text "test" within a text tag using only CSS, without being able to directly change the HTML.
<text
width="13.89"
height="13.89"
x="291.46999999999997"
y="156.55"
transform="rotate(0,277.78,142.86)"
text-anchor="end"
style="fill: rgb(255, 0, 0); font-size: 5pt; display:inline-block; position: relative; top: 50%; left: 50%; transform: translate(50%, -50%);"
>
test
</text>
Currently, a JavaScript function is utilized to position the text at the bottom right-center of a rectangle. However, I aim to achieve alignment to the middle-center instead. Given that all rectangles are uniform in size, adjusting the CSS properties like 'left' and 'top' by -15px may be a viable solution.
The question remains: Can this repositioning of the text element to the center-center of the rectangle be accomplished solely utilizing CSS?