0

I have been trying to vertically center text within a box in Inkscape 1.2, using the tool circled in red:

enter image description here

The result isn't perfect: as you can see, the text is aligned using the height of the highest character (the "A" on the left, and the "x" on the right).

The result I would like is this:

enter image description here

This is done using HTML/CSS. The boxes have the following CSS properties that result in the wanted vertical alignment:

.box {
    display: flex;
    align-items: center;
}

How can I achieve this kind of vertical alignment in Inkscape?

On a side note, I noticed that the height of the selection box is used to center the text in the last example:

enter image description here

I'm not shure how the height of this selection box is calculated though.

1 Answer 1

0

Maybe there is a better way, but you can drag a text boundary with the text tool that is the same size as the rectangle object using snapping, then set the line-height to the height of the box in 'px' (or 'mm' etc.) in the toolbar.

Line-height setting highlighted in the toolbar

This is equivalent to the old CSS trick of using line-height to center text:

.box {
    height: 200px;
    line-height: 200px;
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.