M
M
Mitya ToDaSyo2019-04-11 15:02:01
SVG
Mitya ToDaSyo, 2019-04-11 15:02:01

How to center text in svg?

We need a traffic light, scalable, which has numbers inside the sections ...
But how can I center these numbers inside these grids? number could be 1 or 2...

I myself don’t really, but just draw something from a copy of how it turned out, I ask for help!)

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
RAX7, 2019-04-11
@dimastik1986

Remove transformations from the text transform="matrix..., add the text-anchor="middle" attribute , write the value for xthe coordinate as a percentage (50%), and for ythe eye select the desired value in pixels
https://codepen.io/anon/pen/jRmxNR

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question